[bbb-greenlight: 9/16] Hide recording table when disabled through room config (#1988)




commit aeb5edf8a062bddac6dee171f5414ac8fa5dc607
Author: Ahmad Farhat <ahmad af farhat gmail com>
Date:   Tue Aug 4 17:59:47 2020 -0400

    Hide recording table when disabled through room config (#1988)

 app/helpers/application_helper.rb               | 6 ++++++
 app/views/rooms/components/_room_event.html.erb | 2 +-
 app/views/rooms/show.html.erb                   | 4 +++-
 app/views/shared/_header.html.erb               | 2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f6ffe00..dff6e29 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -124,4 +124,10 @@ module ApplicationHelper
     content_for(:page_title) { page_title } if content_for(:page_title).blank?
     page_title
   end
+
+  # Indicates whether the recording tables should be hidden
+  def hide_recording_tables
+    return false unless recording_consent_required?
+    @settings.get_value("Room Configuration Recording") == "disabled"
+  end
 end
diff --git a/app/views/rooms/components/_room_event.html.erb b/app/views/rooms/components/_room_event.html.erb
index c301b67..a218e37 100644
--- a/app/views/rooms/components/_room_event.html.erb
+++ b/app/views/rooms/components/_room_event.html.erb
@@ -40,6 +40,6 @@
   </div>
 </div>
 
-<% if render_recordings %>
+<% if render_recordings && !hide_recording_tables %>
   <%= render "shared/sessions", recordings: @public_recordings, pagy: @pagy, only_public: true, 
user_recordings: false, title: t("room.recordings") %>
 <% end %>
diff --git a/app/views/rooms/show.html.erb b/app/views/rooms/show.html.erb
index 37760bb..4ac224e 100644
--- a/app/views/rooms/show.html.erb
+++ b/app/views/rooms/show.html.erb
@@ -103,7 +103,9 @@
   </div>
 </div>
 
-<%= render "shared/sessions", recordings: @recordings, pagy: @pagy, only_public: false, shared_room: 
@shared_room, user_recordings: false, title: t("room.recordings")%>
+<% unless hide_recording_tables %>
+  <%= render "shared/sessions", recordings: @recordings, pagy: @pagy, only_public: false, shared_room: 
@shared_room, user_recordings: false, title: t("room.recordings")%>
+<% end %>
 
 <%= render "shared/modals/delete_room_modal" %>
 
diff --git a/app/views/shared/_header.html.erb b/app/views/shared/_header.html.erb
index 5fc1ed0..22f0a95 100755
--- a/app/views/shared/_header.html.erb
+++ b/app/views/shared/_header.html.erb
@@ -31,7 +31,7 @@
             <i class="fas fa-home pr-1 "></i><span class="d-none d-sm-inline-block"><%= 
t("header.dropdown.home") %></span>
           <% end %>
 
-          <% if current_user.role.get_permission("can_create_rooms") && 
!current_user.has_role?(:super_admin) %>
+          <% if current_user.role.get_permission("can_create_rooms") && 
!current_user.has_role?(:super_admin) && !hide_recording_tables %>
             <% all_rec_page = params[:controller] == "users" && params[:action] == "recordings" ? "active" : 
"" %>
             <%= link_to get_user_recordings_path(current_user), class: "px-3 mx-1 mt-1 header-nav 
#{all_rec_page}" do %>
               <i class="fas fa-video pr-1"></i><span class="d-none d-sm-inline-block"><%= 
t("header.all_recordings") %></span>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]