wait for moderator with action cable

This commit is contained in:
Zachary Chai
2016-10-26 17:15:44 -04:00
parent 3aeef0a4cf
commit b701f2e9a6
16 changed files with 167 additions and 33 deletions

View File

@ -2,9 +2,9 @@ class BbbController < ApplicationController
# GET /:resource/:id/join
def join
if ( !params[:id] )
if ( params[:id].blank? )
render_response("missing_parameter", "meeting token was not included", :bad_request)
elsif ( !params[:name] )
elsif ( params[:name].blank? )
render_response("missing_parameter", "user name was not included", :bad_request)
else
user = User.find_by username: params[:id]
@ -25,6 +25,12 @@ class BbbController < ApplicationController
options
)
if bbb_res[:returncode] && current_user && current_user == user
ActionCable.server.broadcast "moderator_#{user.username}_join_channel",
moderator: "joined"
end
render_response bbb_res[:messageKey], bbb_res[:message], bbb_res[:status], bbb_res[:response]
end
end
@ -35,6 +41,6 @@ class BbbController < ApplicationController
@message = message
@status = status
@response = response
render status: @status && return
render status: @status
end
end

View File

@ -10,6 +10,10 @@ class LandingController < ApplicationController
end
end
def wait_for_moderator
render layout: false
end
def admin?
@user == current_user
end
@ -20,7 +24,7 @@ class LandingController < ApplicationController
def render_meeting
@meeting_id = params[:id]
params[:action] = 'meetings'
render :action => 'meeting'
render :action => 'meetings'
end
def render_room
@ -30,7 +34,7 @@ class LandingController < ApplicationController
redirect_to root_path
return
end
render :action => 'room'
render :action => 'rooms'
end
end