forked from External/greenlight
handle errors and fix join form
This commit is contained in:
@ -35,14 +35,6 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
helper_method :allow_greenlight_users?
|
||||
|
||||
# Generate a URL to start a meeting.
|
||||
def owner_meeting_url
|
||||
opts = default_meeting_options
|
||||
opts[:user_is_moderator] = true
|
||||
@room.meeting.join_path(current_user.name, opts)
|
||||
end
|
||||
helper_method :owner_meeting_url
|
||||
|
||||
# Determines if a form field needs the is-invalid class.
|
||||
def form_is_invalid?(obj, key)
|
||||
'is-invalid' if !obj.errors.messages[key].empty?
|
||||
|
14
app/controllers/errors_controller.rb
Normal file
14
app/controllers/errors_controller.rb
Normal file
@ -0,0 +1,14 @@
|
||||
class ErrorsController < ApplicationController
|
||||
|
||||
def not_found
|
||||
render status: 404
|
||||
end
|
||||
|
||||
def unprocessable
|
||||
render status: 422
|
||||
end
|
||||
|
||||
def internal_error
|
||||
render status: 500
|
||||
end
|
||||
end
|
@ -35,14 +35,18 @@ class RoomsController < ApplicationController
|
||||
opts = default_meeting_options
|
||||
|
||||
# Assign join name if passed.
|
||||
if params[@room.invite_path]
|
||||
if params[@room.invite_path][:join_name]
|
||||
@join_name = params[@room.invite_path][:join_name]
|
||||
else
|
||||
# Join name not passed.
|
||||
return
|
||||
end
|
||||
|
||||
if @room.is_running?
|
||||
if current_user
|
||||
redirect_to @room.join_path(current_user, opts)
|
||||
elsif join_name = params[:join_name] || params[@room.invite_path][:join_name]
|
||||
redirect_to @room.join_path(current_user.name, opts, current_user.uid)
|
||||
else
|
||||
join_name = params[@room.invite_path][:join_name]
|
||||
redirect_to @room.join_path(join_name, opts)
|
||||
end
|
||||
else
|
||||
@ -65,7 +69,7 @@ class RoomsController < ApplicationController
|
||||
opts = default_meeting_options
|
||||
opts[:user_is_moderator] = true
|
||||
|
||||
redirect_to @room.join_path(current_user, opts)
|
||||
redirect_to @room.join_path(current_user.name, opts, current_user.uid)
|
||||
|
||||
# Notify users that the room has started.
|
||||
# Delay 5 seconds to allow for server start, although the request will retry until it succeeds.
|
||||
|
Reference in New Issue
Block a user