Co-authored-by: Tobias Fiebig <t.fiebig@tudelft.nl> (#1296)

Co-authored-by: Ahmad Farhat <ahmad.af.farhat@gmail.com>
This commit is contained in:
yanosz 2020-06-29 19:43:12 +02:00 committed by GitHub
parent 9a96df6a37
commit 2e4010aed8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 109 additions and 31 deletions

View File

@ -138,11 +138,11 @@ function showCreateRoom(target) {
$("#room_access_code").val(null) $("#room_access_code").val(null)
$("#createRoomModal form").attr("action", $("body").data('relative-root')) $("#createRoomModal form").attr("action", $("body").data('relative-root'))
$("#room_mute_on_join").prop("checked", $("#room_mute_on_join").data("default")) $("#room_mute_on_join").prop("checked", $("#room_mute_on_join").data("default"))
$("#room_require_moderator_approval").prop("checked", $("#room_require_moderator_approval").data("default")) $("#room_require_moderator_approval").prop("checked", $("#room_require_moderator_approval").data("default"))
$("#room_anyone_can_start").prop("checked", $("#room_anyone_can_start").data("default")) $("#room_anyone_can_start").prop("checked", $("#room_anyone_can_start").data("default"))
$("#room_all_join_moderator").prop("checked", $("#room_all_join_moderator").data("default")) $("#room_all_join_moderator").prop("checked", $("#room_all_join_moderator").data("default"))
$("#room_recording").prop("checked", $("#room_recording").data("default"))
//show all elements & their children with a create-only class //show all elements & their children with a create-only class
$(".create-only").each(function() { $(".create-only").each(function() {
@ -155,6 +155,9 @@ function showCreateRoom(target) {
$(this).attr('style',"display:none !important") $(this).attr('style',"display:none !important")
if($(this).children().length > 0) { $(this).children().attr('style',"display:none !important") } if($(this).children().length > 0) { $(this).children().attr('style',"display:none !important") }
}) })
runningSessionWarningVisibilty(false)
} }
function showUpdateRoom(target) { function showUpdateRoom(target) {
@ -187,6 +190,9 @@ function showUpdateRoom(target) {
$("#create-room-access-code").text(getLocalizedString("modal.create_room.access_code_placeholder")) $("#create-room-access-code").text(getLocalizedString("modal.create_room.access_code_placeholder"))
$("#room_access_code").val(null) $("#room_access_code").val(null)
} }
runningSessionWarningVisibilty(false)
} }
function showDeleteRoom(target) { function showDeleteRoom(target) {
@ -197,12 +203,15 @@ function showDeleteRoom(target) {
//Update the createRoomModal to show the correct current settings //Update the createRoomModal to show the correct current settings
function updateCurrentSettings(settings_path){ function updateCurrentSettings(settings_path){
// Get current room settings and set checkbox // Get current room settings and set checkbox
$.get(settings_path, function(room_settings) { $.get(settings_path, function(settings) {
var settings = JSON.parse(room_settings)
$("#room_mute_on_join").prop("checked", $("#room_mute_on_join").data("default") || settings.muteOnStart) $("#room_mute_on_join").prop("checked", $("#room_mute_on_join").data("default") || settings.muteOnStart)
$("#room_require_moderator_approval").prop("checked", $("#room_require_moderator_approval").data("default") || settings.requireModeratorApproval) $("#room_require_moderator_approval").prop("checked", $("#room_require_moderator_approval").data("default") || settings.requireModeratorApproval)
$("#room_anyone_can_start").prop("checked", $("#room_anyone_can_start").data("default") || settings.anyoneCanStart) $("#room_anyone_can_start").prop("checked", $("#room_anyone_can_start").data("default") || settings.anyoneCanStart)
$("#room_all_join_moderator").prop("checked", $("#room_all_join_moderator").data("default") || settings.joinModerator) $("#room_all_join_moderator").prop("checked", $("#room_all_join_moderator").data("default") || settings.joinModerator)
$("#room_recording").prop("checked", $("#room_recording").data("default") || settings.recording)
runningSessionWarningVisibilty(settings.running)
}) })
} }
@ -264,3 +273,14 @@ function removeSharedUser(target) {
parentLI.classList.add("remove-shared") parentLI.classList.add("remove-shared")
} }
} }
// Show a "Session Running warning" for each room setting, which cannot be changed during a running session
function runningSessionWarningVisibilty(isRunning) {
if(isRunning) {
$(".running-only").show()
$(".not-running-only").hide()
} else {
$(".running-only").hide()
$(".not-running-only").show()
}
}

View File

@ -87,7 +87,7 @@ module Joiner
{ {
user_is_moderator: false, user_is_moderator: false,
meeting_logout_url: request.base_url + logout_room_path(@room), meeting_logout_url: request.base_url + logout_room_path(@room),
meeting_recorded: true, meeting_recorded: @room.recording?,
moderator_message: "#{invite_msg}\n\n#{request.base_url + room_path(@room)}", moderator_message: "#{invite_msg}\n\n#{request.base_url + room_path(@room)}",
host: request.host, host: request.host,
recording_default_visibility: @settings.get_value("Default Recording Visibility") == "public" recording_default_visibility: @settings.get_value("Default Recording Visibility") == "public"
@ -105,6 +105,8 @@ module Joiner
"Room Configuration All Join Moderator" "Room Configuration All Join Moderator"
when "anyoneCanStart" when "anyoneCanStart"
"Room Configuration Allow Any Start" "Room Configuration Allow Any Start"
when "recording"
"Room Configuration Recording"
end end
case @settings.get_value(config) case @settings.get_value(config)

View File

@ -171,7 +171,7 @@ class RoomsController < ApplicationController
@room_settings = JSON.parse(@room[:room_settings]) @room_settings = JSON.parse(@room[:room_settings])
opts[:mute_on_start] = room_setting_with_config("muteOnStart") opts[:mute_on_start] = room_setting_with_config("muteOnStart")
opts[:require_moderator_approval] = room_setting_with_config("requireModeratorApproval") opts[:require_moderator_approval] = room_setting_with_config("requireModeratorApproval")
opts[:record] = room_setting_with_config("recording")
begin begin
redirect_to join_path(@room, current_user.name, opts, current_user.uid) redirect_to join_path(@room, current_user.name, opts, current_user.uid)
rescue BigBlueButton::BigBlueButtonException => e rescue BigBlueButton::BigBlueButtonException => e
@ -261,8 +261,10 @@ class RoomsController < ApplicationController
# GET /:room_uid/room_settings # GET /:room_uid/room_settings
def room_settings def room_settings
# Respond with JSON object of the room_settings # Respond with JSON object of the room_settings
status = { running: room_running?(@room.bbb_id) }
settings = @room.settings_hash
respond_to do |format| respond_to do |format|
format.json { render body: @room.room_settings.to_json } format.json { render body: status.merge(settings).to_json }
end end
end end
@ -291,6 +293,7 @@ class RoomsController < ApplicationController
"requireModeratorApproval": options[:require_moderator_approval] == "1", "requireModeratorApproval": options[:require_moderator_approval] == "1",
"anyoneCanStart": options[:anyone_can_start] == "1", "anyoneCanStart": options[:anyone_can_start] == "1",
"joinModerator": options[:all_join_moderator] == "1", "joinModerator": options[:all_join_moderator] == "1",
"recording": options[:recording] == "1",
} }
room_settings.to_json room_settings.to_json
@ -298,7 +301,8 @@ class RoomsController < ApplicationController
def room_params def room_params
params.require(:room).permit(:name, :auto_join, :mute_on_join, :access_code, params.require(:room).permit(:name, :auto_join, :mute_on_join, :access_code,
:require_moderator_approval, :anyone_can_start, :all_join_moderator) :require_moderator_approval, :anyone_can_start, :all_join_moderator,
:recording)
end end
# Find the room from the uid. # Find the room from the uid.

View File

@ -97,6 +97,14 @@ class Room < ApplicationRecord
table.order(Arel.sql(order_string)) table.order(Arel.sql(order_string))
end end
def settings_hash
JSON.parse(room_settings || "{}")
end
def recording?
settings_hash["recording"]
end
private private
# Generates a uid for the room and BigBlueButton. # Generates a uid for the room and BigBlueButton.

View File

@ -70,6 +70,8 @@ class Setting < ApplicationRecord
room_config_setting("anyone-can-start") room_config_setting("anyone-can-start")
when "Room Configuration All Join Moderator" when "Room Configuration All Join Moderator"
room_config_setting("all-join-moderator") room_config_setting("all-join-moderator")
when "Room Configuration Recording"
room_config_setting("recording")
end end
end end

View File

@ -98,4 +98,31 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="mb-6 row">
<div class="col-12">
<div class="form-group">
<label class="form-label"><%= t("modal.room_settings.recordings") %></label>
<label class="form-label text-muted"><%= t("administrator.room_configuration.recordings.info") %></label>
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= room_configuration_string("Room Configuration Recording") %>
</button>
<div class="dropdown-menu">
<%= button_to admin_update_room_configuration_path(setting: "Room Configuration Recording", value: "enabled"), class: "dropdown-item", "data-disable": "" do %>
<%= t("administrator.room_configuration.options.enabled") %>
<% end %>
<%= button_to admin_update_room_configuration_path(setting: "Room Configuration Recording", value: "optional"), class: "dropdown-item", "data-disable": "" do %>
<%= t("administrator.room_configuration.options.optional") %>
<% end %>
<%= button_to admin_update_room_configuration_path(setting: "Room Configuration Recording", value: "disabled"), class: "dropdown-item", "data-disable": "" do %>
<%= t("administrator.room_configuration.options.disabled") %>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -18,6 +18,7 @@
<div class="row pt-9"> <div class="row pt-9">
<div class="col-lg-12 col-sm-12"> <div class="col-lg-12 col-sm-12">
<h4 class="text-left"><%= t("room.invited") %></h4> <h4 class="text-left"><%= t("room.invited") %></h4>
<h4 class="text-left text-danger"><%= t("room.recording_present") if @room.recording?%></h4>
<h1 class="display-3 text-left mb-3 font-weight-400"><%= @room.name %></h1> <h1 class="display-3 text-left mb-3 font-weight-400"><%= @room.name %></h1>
<hr class="mt-2 float-left w-25"> <hr class="mt-2 float-left w-25">
</div> </div>

View File

@ -69,7 +69,6 @@
<span class="custom-switch-indicator float-right cursor-pointer"></span> <span class="custom-switch-indicator float-right cursor-pointer"></span>
</label> </label>
<% end %> <% end %>
<% moderator = room_configuration("Room Configuration All Join Moderator") %> <% moderator = room_configuration("Room Configuration All Join Moderator") %>
<% if moderator != "disabled" %> <% if moderator != "disabled" %>
<label class="custom-switch pl-0 mt-3 mb-3 w-100 text-left d-inline-block <%= "enabled-setting" if moderator == "enabled" %>"> <label class="custom-switch pl-0 mt-3 mb-3 w-100 text-left d-inline-block <%= "enabled-setting" if moderator == "enabled" %>">
@ -78,7 +77,15 @@
<span class="custom-switch-indicator float-right cursor-pointer"></span> <span class="custom-switch-indicator float-right cursor-pointer"></span>
</label> </label>
<% end %> <% end %>
<% recording = room_configuration("Room Configuration Recording") %>
<% if recording != "disabled" %>
<label class="custom-switch pl-0 mt-3 mb-3 w-100 text-left d-inline-block <%= "enabled-setting" if recording == "enabled" %>">
<span class="custom-switch-description"><%= t("modal.room_settings.recording")%></span>
<%= f.check_box :recording, class: "not-running-only custom-switch-input", data: { default: recording == "enabled" }, checked: false %>
<span class="float-right cursor-pointer running-only text-danger" style="display: none"><%= t("modal.room_settings.session_active")%></span>
<span class="custom-switch-indicator not-running-only float-right cursor-pointer"></span>
</label>
<% end %>
<label id="auto-join-label" class="create-only custom-switch pl-0 mt-3 mb-3 w-100 text-left d-inline-block"> <label id="auto-join-label" class="create-only custom-switch pl-0 mt-3 mb-3 w-100 text-left d-inline-block">
<span class="custom-switch-description"><%= t("modal.create_room.auto_join") %></span> <span class="custom-switch-description"><%= t("modal.create_room.auto_join") %></span>
<%= f.check_box :auto_join, class: "custom-switch-input", checked: false %> <%= f.check_box :auto_join, class: "custom-switch-input", checked: false %>

View File

@ -52,16 +52,16 @@ module Greenlight
# Use standalone BigBlueButton server. # Use standalone BigBlueButton server.
config.bigbluebutton_endpoint = if ENV["BIGBLUEBUTTON_ENDPOINT"].present? config.bigbluebutton_endpoint = if ENV["BIGBLUEBUTTON_ENDPOINT"].present?
ENV["BIGBLUEBUTTON_ENDPOINT"] ENV["BIGBLUEBUTTON_ENDPOINT"]
else else
config.bigbluebutton_endpoint_default config.bigbluebutton_endpoint_default
end end
config.bigbluebutton_secret = if ENV["BIGBLUEBUTTON_SECRET"].present? config.bigbluebutton_secret = if ENV["BIGBLUEBUTTON_SECRET"].present?
ENV["BIGBLUEBUTTON_SECRET"] ENV["BIGBLUEBUTTON_SECRET"]
else else
config.bigbluebutton_secret_default config.bigbluebutton_secret_default
end end
# Fix endpoint format if required. # Fix endpoint format if required.
config.bigbluebutton_endpoint += "/" unless config.bigbluebutton_endpoint.ends_with?('/') config.bigbluebutton_endpoint += "/" unless config.bigbluebutton_endpoint.ends_with?('/')
@ -144,12 +144,12 @@ module Greenlight
# Default registration method if the user does not specify one # Default registration method if the user does not specify one
config.registration_method_default = if ENV["DEFAULT_REGISTRATION"] == "invite" config.registration_method_default = if ENV["DEFAULT_REGISTRATION"] == "invite"
config.registration_methods[:invite] config.registration_methods[:invite]
elsif ENV["DEFAULT_REGISTRATION"] == "approval" elsif ENV["DEFAULT_REGISTRATION"] == "approval"
config.registration_methods[:approval] config.registration_methods[:approval]
else else
config.registration_methods[:open] config.registration_methods[:open]
end end
# Default limit on number of rooms users can create # Default limit on number of rooms users can create
config.number_of_rooms_default = 15 config.number_of_rooms_default = 15

View File

@ -156,6 +156,8 @@ en:
info: Allows any user to start the meeting at any time. By default, only the room owner can start the meeting. info: Allows any user to start the meeting at any time. By default, only the room owner can start the meeting.
all_moderator: all_moderator:
info: Gives all users moderator privileges in BigBlueButton when they join the meeting. info: Gives all users moderator privileges in BigBlueButton when they join the meeting.
recordings:
info: Records a recording of the room and enables moderators to set recording markers
options: options:
disabled: Disabled disabled: Disabled
enabled: Always Enabled enabled: Always Enabled
@ -409,10 +411,13 @@ en:
update: Update Room update: Update Room
client: Select client type client: Select client type
join_moderator: All users join as moderators join_moderator: All users join as moderators
recordings: Enable room recordings
mute: Mute users when they join mute: Mute users when they join
require_approval: Require moderator approval before joining require_approval: Require moderator approval before joining
start: Allow any user to start this meeting start: Allow any user to start this meeting
footer_text: Adjustment to your room can be done at anytime. footer_text: Adjustment to your room can be done at anytime.
recording: Record sessions
session_active: Active session
rename_room: rename_room:
name_placeholder: Enter a new room name... name_placeholder: Enter a new room name...
share_access: share_access:
@ -517,6 +522,7 @@ en:
enter_the_access_code: Enter the room's access code enter_the_access_code: Enter the room's access code
invalid_provider: You have entered an invalid url. Please check the url and try again. invalid_provider: You have entered an invalid url. Please check the url and try again.
invited: You have been invited to join invited: You have been invited to join
recording_present: The session is going to be recorded. This includes voice and video from your side.
invite_participants: Invite Participants invite_participants: Invite Participants
join: Join join: Join
last_session: Last session on %{session} last_session: Last session on %{session}

View File

@ -156,7 +156,8 @@ RELATIVE_URL_ROOT=/b
# require-moderator-approval: Require moderators to approve new users before they can join the room # require-moderator-approval: Require moderators to approve new users before they can join the room
# anyone-can-start: Allows anyone with the join url to start the room in BigBlueButton # anyone-can-start: Allows anyone with the join url to start the room in BigBlueButton
# all-join-moderator: All users join as moderators in BigBlueButton # all-join-moderator: All users join as moderators in BigBlueButton
ROOM_FEATURES=mute-on-join,require-moderator-approval,anyone-can-start,all-join-moderator # recording: Sessions are recorded
ROOM_FEATURES=mute-on-join,require-moderator-approval,anyone-can-start,all-join-moderator,recording
# Specify the maximum number of records to be sent to the BigBlueButton API in one call # Specify the maximum number of records to be sent to the BigBlueButton API in one call
# Default is set to 25 records # Default is set to 25 records

View File

@ -185,7 +185,7 @@ describe RoomsController, type: :controller do
room_params = { name: name, "mute_on_join": "1", room_params = { name: name, "mute_on_join": "1",
"require_moderator_approval": "1", "anyone_can_start": "1", "all_join_moderator": "1" } "require_moderator_approval": "1", "anyone_can_start": "1", "all_join_moderator": "1" }
json_room_settings = "{\"muteOnStart\":true,\"requireModeratorApproval\":true," \ json_room_settings = "{\"muteOnStart\":true,\"requireModeratorApproval\":true," \
"\"anyoneCanStart\":true,\"joinModerator\":true}" "\"anyoneCanStart\":true,\"joinModerator\":true,\"recording\":false}"
post :create, params: { room: room_params } post :create, params: { room: room_params }
@ -202,12 +202,12 @@ describe RoomsController, type: :controller do
@owner.main_room.update_attribute(:room_settings, { "muteOnStart": true, "requireModeratorApproval": true, @owner.main_room.update_attribute(:room_settings, { "muteOnStart": true, "requireModeratorApproval": true,
"anyoneCanStart": true, "joinModerator": true }.to_json) "anyoneCanStart": true, "joinModerator": true }.to_json)
json_room_settings = "{\"muteOnStart\":true,\"requireModeratorApproval\":true," \ json_room_settings = "{\"running\":false,\"muteOnStart\":true,\"requireModeratorApproval\":true," \
"\"anyoneCanStart\":true,\"joinModerator\":true}" "\"anyoneCanStart\":true,\"joinModerator\":true}"
get :room_settings, params: { room_uid: @owner.main_room }, format: :json get :room_settings, params: { room_uid: @owner.main_room }, format: :json
expect(JSON.parse(response.body)).to eql(json_room_settings) expect(JSON.parse(response.body).to_json).to eql(json_room_settings)
end end
it "should redirect to root if not logged in" do it "should redirect to root if not logged in" do
@ -583,9 +583,9 @@ describe RoomsController, type: :controller do
it "properly updates room settings through the room settings modal and redirects to current page" do it "properly updates room settings through the room settings modal and redirects to current page" do
@request.session[:user_id] = @user.id @request.session[:user_id] = @user.id
room_params = { "mute_on_join": "1", "name": @secondary_room.name } room_params = { "mute_on_join": "1", "name": @secondary_room.name, "recording": "1" }
formatted_room_params = "{\"muteOnStart\":true,\"requireModeratorApproval\":false," \ formatted_room_params = "{\"muteOnStart\":true,\"requireModeratorApproval\":false," \
"\"anyoneCanStart\":false,\"joinModerator\":false}" # JSON string format "\"anyoneCanStart\":false,\"joinModerator\":false,\"recording\":true}" # JSON string format
expect { post :update_settings, params: { room_uid: @secondary_room.uid, room: room_params } } expect { post :update_settings, params: { room_uid: @secondary_room.uid, room: room_params } }
.to change { @secondary_room.reload.room_settings } .to change { @secondary_room.reload.room_settings }
@ -608,7 +608,7 @@ describe RoomsController, type: :controller do
room_params = { "mute_on_join": "1", "name": @secondary_room.name } room_params = { "mute_on_join": "1", "name": @secondary_room.name }
formatted_room_params = "{\"muteOnStart\":true,\"requireModeratorApproval\":false," \ formatted_room_params = "{\"muteOnStart\":true,\"requireModeratorApproval\":false," \
"\"anyoneCanStart\":false,\"joinModerator\":false}" # JSON string format "\"anyoneCanStart\":false,\"joinModerator\":false,\"recording\":false}" # JSON string format
expect { post :update_settings, params: { room_uid: @secondary_room.uid, room: room_params } } expect { post :update_settings, params: { room_uid: @secondary_room.uid, room: room_params } }
.to change { @secondary_room.reload.room_settings } .to change { @secondary_room.reload.room_settings }