forked from External/greenlight
Added room configuration tab to admin panel
This commit is contained in:
@ -73,6 +73,10 @@ class AdminsController < ApplicationController
|
||||
@pagy, @rooms = pagy_array(server_rooms_list)
|
||||
end
|
||||
|
||||
# GET /admins/room_configuration
|
||||
def room_configuration
|
||||
end
|
||||
|
||||
# MANAGE USERS
|
||||
|
||||
# GET /admins/edit/:user_uid
|
||||
@ -241,6 +245,16 @@ class AdminsController < ApplicationController
|
||||
redirect_to admin_site_settings_path, flash: { success: I18n.t("administrator.flash.settings") }
|
||||
end
|
||||
|
||||
# ROOM CONFIGURATION
|
||||
# POST /admins/update_room_configuration
|
||||
def update_room_configuration
|
||||
@settings.update_value(params[:setting], params[:value])
|
||||
|
||||
flash_message = I18n.t("administrator.flash.room_configuration")
|
||||
|
||||
redirect_to admin_room_configuration_path, flash: { success: flash_message }
|
||||
end
|
||||
|
||||
# ROLES
|
||||
|
||||
# GET /admins/roles
|
||||
|
@ -48,15 +48,15 @@ module Joiner
|
||||
end
|
||||
|
||||
def join_room(opts)
|
||||
room_settings = JSON.parse(@room[:room_settings])
|
||||
@room_settings = JSON.parse(@room[:room_settings])
|
||||
|
||||
if room_running?(@room.bbb_id) || @room.owned_by?(current_user) || room_settings["anyoneCanStart"]
|
||||
if room_running?(@room.bbb_id) || @room.owned_by?(current_user) || room_setting_with_config("anyoneCanStart")
|
||||
|
||||
# Determine if the user needs to join as a moderator.
|
||||
opts[:user_is_moderator] = @room.owned_by?(current_user) || room_settings["joinModerator"] || @shared_room
|
||||
opts[:user_is_moderator] = @room.owned_by?(current_user) || room_setting_with_config("joinModerator") || @shared_room
|
||||
|
||||
opts[:require_moderator_approval] = room_settings["requireModeratorApproval"]
|
||||
opts[:mute_on_start] = room_settings["muteOnStart"]
|
||||
opts[:require_moderator_approval] = room_setting_with_config("requireModeratorApproval")
|
||||
opts[:mute_on_start] = room_setting_with_config("muteOnStart")
|
||||
|
||||
if current_user
|
||||
redirect_to join_path(@room, current_user.name, opts, current_user.uid)
|
||||
@ -92,4 +92,27 @@ module Joiner
|
||||
recording_default_visibility: @settings.get_value("Default Recording Visibility") == "public"
|
||||
}
|
||||
end
|
||||
|
||||
# Gets the room setting based on the option set in the room configuration
|
||||
def room_setting_with_config(name)
|
||||
config = case name
|
||||
when "muteOnStart"
|
||||
"Room Configuration Mute On Join"
|
||||
when "requireModeratorApproval"
|
||||
"Room Configuration Require Moderator"
|
||||
when "joinModerator"
|
||||
"Room Configuration All Join Moderator"
|
||||
when "anyoneCanStart"
|
||||
"Room Configuration Allow Any Start"
|
||||
end
|
||||
|
||||
case @settings.get_value(config)
|
||||
when "enabled"
|
||||
true
|
||||
when "optional"
|
||||
@room_settings[name]
|
||||
when "disabled"
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -160,9 +160,9 @@ class RoomsController < ApplicationController
|
||||
opts[:user_is_moderator] = true
|
||||
|
||||
# Include the user's choices for the room settings
|
||||
room_settings = JSON.parse(@room[:room_settings])
|
||||
opts[:mute_on_start] = room_settings["muteOnStart"]
|
||||
opts[:require_moderator_approval] = room_settings["requireModeratorApproval"]
|
||||
@room_settings = JSON.parse(@room[:room_settings])
|
||||
opts[:mute_on_start] = room_setting_with_config("muteOnStart")
|
||||
opts[:require_moderator_approval] = room_setting_with_config("requireModeratorApproval")
|
||||
|
||||
begin
|
||||
redirect_to join_path(@room, current_user.name, opts, current_user.uid)
|
||||
|
Reference in New Issue
Block a user