forked from External/greenlight
Rework on landingController to reduce duplication
This commit is contained in:
parent
5a5693cb33
commit
970670ba6f
|
@ -17,6 +17,8 @@
|
|||
class LandingController < ApplicationController
|
||||
include BbbApi
|
||||
|
||||
helper_method :admin?
|
||||
|
||||
def index
|
||||
# If guest access is disabled, redirect the user to the guest landing and force login.
|
||||
redirect_to guest_path if Rails.configuration.disable_guest_access
|
||||
|
@ -51,21 +53,13 @@ class LandingController < ApplicationController
|
|||
|
||||
def wait_for_moderator
|
||||
WaitingList.add(params[:room_id], params[:name], params[:id])
|
||||
ActionCable.server.broadcast 'refresh_meetings',
|
||||
method: 'waiting',
|
||||
meeting: params[:id],
|
||||
room: params[:room_id],
|
||||
user: params[:name]
|
||||
send_alert(params, 'waiting')
|
||||
render layout: false
|
||||
end
|
||||
|
||||
def no_longer_waiting
|
||||
WaitingList.remove(params[:room_id], params[:name], params[:id])
|
||||
ActionCable.server.broadcast 'refresh_meetings',
|
||||
method: 'no_longer_waiting',
|
||||
meeting: params[:id],
|
||||
room: params[:room_id],
|
||||
user: params[:name]
|
||||
send_alert(params, 'no_longer_waiting')
|
||||
end
|
||||
|
||||
def session_status_refresh
|
||||
|
@ -83,7 +77,6 @@ class LandingController < ApplicationController
|
|||
def admin?
|
||||
@user && @user == current_user
|
||||
end
|
||||
helper_method :admin?
|
||||
|
||||
def preferences
|
||||
@user = current_user
|
||||
|
@ -124,4 +117,11 @@ class LandingController < ApplicationController
|
|||
render :action => 'rooms'
|
||||
end
|
||||
|
||||
def send_alert(params, method)
|
||||
ActionCable.server.broadcast 'refresh_meetings',
|
||||
method: method,
|
||||
meeting: params[:id],
|
||||
room: params[:room_id],
|
||||
user: params[:name]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue