forked from External/greenlight
		
	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:
		| @@ -138,11 +138,11 @@ function showCreateRoom(target) { | ||||
|   $("#room_access_code").val(null) | ||||
|  | ||||
|   $("#createRoomModal form").attr("action", $("body").data('relative-root')) | ||||
|  | ||||
|   $("#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_anyone_can_start").prop("checked", $("#room_anyone_can_start").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 | ||||
|   $(".create-only").each(function() { | ||||
| @@ -155,6 +155,9 @@ function showCreateRoom(target) { | ||||
|     $(this).attr('style',"display:none !important") | ||||
|     if($(this).children().length > 0) { $(this).children().attr('style',"display:none !important") } | ||||
|   }) | ||||
|  | ||||
|   runningSessionWarningVisibilty(false) | ||||
|  | ||||
| } | ||||
|  | ||||
| function showUpdateRoom(target) { | ||||
| @@ -187,6 +190,9 @@ function showUpdateRoom(target) { | ||||
|     $("#create-room-access-code").text(getLocalizedString("modal.create_room.access_code_placeholder")) | ||||
|     $("#room_access_code").val(null) | ||||
|   } | ||||
|  | ||||
|   runningSessionWarningVisibilty(false) | ||||
|  | ||||
| } | ||||
|  | ||||
| function showDeleteRoom(target) { | ||||
| @@ -197,12 +203,15 @@ function showDeleteRoom(target) { | ||||
| //Update the createRoomModal to show the correct current settings | ||||
| function updateCurrentSettings(settings_path){ | ||||
|   // Get current room settings and set checkbox | ||||
|   $.get(settings_path, function(room_settings) { | ||||
|     var settings = JSON.parse(room_settings)  | ||||
|   $.get(settings_path, function(settings) { | ||||
|     $("#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_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_recording").prop("checked", $("#room_recording").data("default") || settings.recording) | ||||
|  | ||||
|     runningSessionWarningVisibilty(settings.running) | ||||
|  | ||||
|   }) | ||||
| } | ||||
|  | ||||
| @@ -264,3 +273,14 @@ function removeSharedUser(target) { | ||||
|     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() | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -87,7 +87,7 @@ module Joiner | ||||
|     { | ||||
|       user_is_moderator: false, | ||||
|       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)}", | ||||
|       host: request.host, | ||||
|       recording_default_visibility: @settings.get_value("Default Recording Visibility") == "public" | ||||
| @@ -105,6 +105,8 @@ module Joiner | ||||
|       "Room Configuration All Join Moderator" | ||||
|     when "anyoneCanStart" | ||||
|       "Room Configuration Allow Any Start" | ||||
|     when "recording" | ||||
|      "Room Configuration Recording" | ||||
|     end | ||||
|  | ||||
|     case @settings.get_value(config) | ||||
|   | ||||
| @@ -171,7 +171,7 @@ class RoomsController < ApplicationController | ||||
|     @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") | ||||
|  | ||||
|     opts[:record] = room_setting_with_config("recording") | ||||
|     begin | ||||
|       redirect_to join_path(@room, current_user.name, opts, current_user.uid) | ||||
|     rescue BigBlueButton::BigBlueButtonException => e | ||||
| @@ -261,8 +261,10 @@ class RoomsController < ApplicationController | ||||
|   # GET /:room_uid/room_settings | ||||
|   def 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| | ||||
|       format.json { render body: @room.room_settings.to_json } | ||||
|       format.json { render body: status.merge(settings).to_json } | ||||
|     end | ||||
|   end | ||||
|  | ||||
| @@ -291,6 +293,7 @@ class RoomsController < ApplicationController | ||||
|       "requireModeratorApproval": options[:require_moderator_approval] == "1", | ||||
|       "anyoneCanStart": options[:anyone_can_start] == "1", | ||||
|       "joinModerator": options[:all_join_moderator] == "1", | ||||
|       "recording": options[:recording] == "1", | ||||
|     } | ||||
|  | ||||
|     room_settings.to_json | ||||
| @@ -298,7 +301,8 @@ class RoomsController < ApplicationController | ||||
|  | ||||
|   def room_params | ||||
|     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 | ||||
|  | ||||
|   # Find the room from the uid. | ||||
|   | ||||
| @@ -97,6 +97,14 @@ class Room < ApplicationRecord | ||||
|     table.order(Arel.sql(order_string)) | ||||
|   end | ||||
|  | ||||
|   def settings_hash | ||||
|     JSON.parse(room_settings || "{}") | ||||
|   end | ||||
|  | ||||
|   def recording? | ||||
|     settings_hash["recording"] | ||||
|   end | ||||
|  | ||||
|   private | ||||
|  | ||||
|   # Generates a uid for the room and BigBlueButton. | ||||
|   | ||||
| @@ -70,6 +70,8 @@ class Setting < ApplicationRecord | ||||
|       room_config_setting("anyone-can-start") | ||||
|     when "Room Configuration All Join Moderator" | ||||
|       room_config_setting("all-join-moderator") | ||||
|     when "Room Configuration Recording" | ||||
|       room_config_setting("recording") | ||||
|     end | ||||
|   end | ||||
|  | ||||
|   | ||||
| @@ -98,4 +98,31 @@ | ||||
|       </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> | ||||
|   | ||||
| @@ -18,6 +18,7 @@ | ||||
|     <div class="row pt-9"> | ||||
|       <div class="col-lg-12 col-sm-12"> | ||||
|         <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> | ||||
|         <hr class="mt-2 float-left w-25"> | ||||
|       </div> | ||||
|   | ||||
| @@ -69,7 +69,6 @@ | ||||
|                 <span class="custom-switch-indicator float-right cursor-pointer"></span> | ||||
|               </label> | ||||
|             <% end %> | ||||
|  | ||||
|             <% moderator = room_configuration("Room Configuration All Join Moderator") %> | ||||
|             <% 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" %>"> | ||||
| @@ -78,7 +77,15 @@ | ||||
|                 <span class="custom-switch-indicator float-right cursor-pointer"></span> | ||||
|               </label> | ||||
|             <% 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"> | ||||
|               <span class="custom-switch-description"><%= t("modal.create_room.auto_join") %></span> | ||||
|               <%= f.check_box :auto_join, class: "custom-switch-input", checked: false %> | ||||
|   | ||||
| @@ -52,16 +52,16 @@ module Greenlight | ||||
|  | ||||
|     # Use standalone BigBlueButton server. | ||||
|     config.bigbluebutton_endpoint = if ENV["BIGBLUEBUTTON_ENDPOINT"].present? | ||||
|        ENV["BIGBLUEBUTTON_ENDPOINT"] | ||||
|     else | ||||
|       config.bigbluebutton_endpoint_default | ||||
|     end | ||||
|                                       ENV["BIGBLUEBUTTON_ENDPOINT"] | ||||
|                                     else | ||||
|                                       config.bigbluebutton_endpoint_default | ||||
|                                     end | ||||
|  | ||||
|     config.bigbluebutton_secret = if ENV["BIGBLUEBUTTON_SECRET"].present? | ||||
|       ENV["BIGBLUEBUTTON_SECRET"] | ||||
|     else | ||||
|       config.bigbluebutton_secret_default | ||||
|     end | ||||
|                                     ENV["BIGBLUEBUTTON_SECRET"] | ||||
|                                   else | ||||
|                                     config.bigbluebutton_secret_default | ||||
|                                   end | ||||
|  | ||||
|     # Fix endpoint format if required. | ||||
|     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 | ||||
|     config.registration_method_default = if ENV["DEFAULT_REGISTRATION"] == "invite" | ||||
|       config.registration_methods[:invite] | ||||
|     elsif ENV["DEFAULT_REGISTRATION"] == "approval" | ||||
|       config.registration_methods[:approval] | ||||
|     else | ||||
|       config.registration_methods[:open] | ||||
|     end | ||||
|                                            config.registration_methods[:invite] | ||||
|                                          elsif ENV["DEFAULT_REGISTRATION"] == "approval" | ||||
|                                            config.registration_methods[:approval] | ||||
|                                          else | ||||
|                                            config.registration_methods[:open] | ||||
|                                          end | ||||
|  | ||||
|     # Default limit on number of rooms users can create | ||||
|     config.number_of_rooms_default = 15 | ||||
|   | ||||
| @@ -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. | ||||
|       all_moderator: | ||||
|         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: | ||||
|         disabled: Disabled | ||||
|         enabled: Always Enabled | ||||
| @@ -409,10 +411,13 @@ en: | ||||
|       update: Update Room | ||||
|       client: Select client type | ||||
|       join_moderator: All users join as moderators | ||||
|       recordings: Enable room recordings | ||||
|       mute: Mute users when they join | ||||
|       require_approval: Require moderator approval before joining | ||||
|       start: Allow any user to start this meeting | ||||
|       footer_text: Adjustment to your room can be done at anytime. | ||||
|       recording: Record sessions | ||||
|       session_active: Active session | ||||
|     rename_room: | ||||
|       name_placeholder: Enter a new room name... | ||||
|     share_access: | ||||
| @@ -517,6 +522,7 @@ en: | ||||
|     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. | ||||
|     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 | ||||
|     join: Join | ||||
|     last_session: Last session on %{session} | ||||
|   | ||||
| @@ -156,7 +156,8 @@ RELATIVE_URL_ROOT=/b | ||||
| #   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 | ||||
| #   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 | ||||
| # Default is set to 25 records | ||||
|   | ||||
| @@ -185,7 +185,7 @@ describe RoomsController, type: :controller do | ||||
|       room_params = { name: name, "mute_on_join": "1", | ||||
|         "require_moderator_approval": "1", "anyone_can_start": "1", "all_join_moderator": "1" } | ||||
|       json_room_settings = "{\"muteOnStart\":true,\"requireModeratorApproval\":true," \ | ||||
|         "\"anyoneCanStart\":true,\"joinModerator\":true}" | ||||
|         "\"anyoneCanStart\":true,\"joinModerator\":true,\"recording\":false}" | ||||
|  | ||||
|       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, | ||||
|       "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}" | ||||
|  | ||||
|       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 | ||||
|  | ||||
|     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 | ||||
|       @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," \ | ||||
|         "\"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 } } | ||||
|         .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 } | ||||
|       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 } } | ||||
|         .to change { @secondary_room.reload.room_settings } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user