From ec93d5e472343c466d5a69c2efac3375dbd4c139 Mon Sep 17 00:00:00 2001 From: Ahmad Farhat Date: Thu, 30 Jul 2020 10:50:04 -0400 Subject: [PATCH] GRN2-xx: Fixed issue with join warning displaying incorrectly (#1957) * Fixed issue with room settings * Update room join consent string --- app/controllers/concerns/joiner.rb | 25 ------------------------- app/controllers/rooms_controller.rb | 28 +++++++++++++++++++++++++++- app/helpers/rooms_helper.rb | 9 +++++++++ app/models/room.rb | 4 ---- app/views/rooms/join.html.erb | 2 +- config/locales/en.yml | 2 +- 6 files changed, 38 insertions(+), 32 deletions(-) diff --git a/app/controllers/concerns/joiner.rb b/app/controllers/concerns/joiner.rb index 2583a286..d1aad011 100644 --- a/app/controllers/concerns/joiner.rb +++ b/app/controllers/concerns/joiner.rb @@ -94,31 +94,6 @@ module Joiner } 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" - when "recording" - "Room Configuration Recording" - end - - case @settings.get_value(config) - when "enabled" - true - when "optional" - @room_settings[name] - when "disabled" - false - end - end - private def fetch_guest_id diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb index 59bc4698..b278365c 100644 --- a/app/controllers/rooms_controller.rb +++ b/app/controllers/rooms_controller.rb @@ -62,7 +62,7 @@ class RoomsController < ApplicationController # GET /:room_uid def show - @room_settings = @room[:room_settings] + @room_settings = JSON.parse(@room[:room_settings]) @anyone_can_start = room_setting_with_config("anyoneCanStart") @room_running = room_running?(@room.bbb_id) @shared_room = room_shared_with_user @@ -420,4 +420,30 @@ class RoomsController < ApplicationController def valid_file_type Rails.configuration.allowed_file_types.split(",").include?(File.extname(room_params[:presentation].original_filename)) 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" + when "recording" + "Room Configuration Recording" + end + + case @settings.get_value(config) + when "enabled" + true + when "optional" + @room_settings[name] + when "disabled" + false + end + end + helper_method :room_setting_with_config end diff --git a/app/helpers/rooms_helper.rb b/app/helpers/rooms_helper.rb index de80dd24..b08b52df 100644 --- a/app/helpers/rooms_helper.rb +++ b/app/helpers/rooms_helper.rb @@ -45,4 +45,13 @@ module RoomsHelper def preupload_allowed? @settings.get_value("Preupload Presentation") == "true" end + + def display_joiner_consent + # If the require consent setting is checked, then check the room setting, else, set to false + if recording_consent_required? + room_setting_with_config("recording") + else + false + end + end end diff --git a/app/models/room.rb b/app/models/room.rb index fa35c69f..8feb56c1 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -101,10 +101,6 @@ class Room < ApplicationRecord active_rooms + inactive_rooms end - def recording_enabled? - JSON.parse(room_settings)["recording"] - end - private # Generates a uid for the room and BigBlueButton. diff --git a/app/views/rooms/join.html.erb b/app/views/rooms/join.html.erb index 41104942..f0f247c9 100644 --- a/app/views/rooms/join.html.erb +++ b/app/views/rooms/join.html.erb @@ -51,7 +51,7 @@ - <% if recording_consent_required? && @room.recording_enabled? %> + <% if display_joiner_consent %>