[bbb-greenlight: 13/18] Added env variable to exclude recording formats from public recordings (#2055)




commit 99c7262971d91a7a295eb1a09f5fb9bd7ce091b7
Author: Ahmad Farhat <ahmad af farhat gmail com>
Date:   Thu Sep 3 10:55:24 2020 -0400

    Added env variable to exclude recording formats from public recordings (#2055)

 app/helpers/rooms_helper.rb                                | 5 +++++
 app/views/shared/components/_public_recording_row.html.erb | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/app/helpers/rooms_helper.rb b/app/helpers/rooms_helper.rb
index b08b52d..c14b57e 100644
--- a/app/helpers/rooms_helper.rb
+++ b/app/helpers/rooms_helper.rb
@@ -54,4 +54,9 @@ module RoomsHelper
       false
     end
   end
+
+  # Array of recording formats not to show for public recordings
+  def hidden_format_public
+    ENV.fetch("HIDDEN_FORMATS_PUBLIC", "").split(",")
+  end
 end
diff --git a/app/views/shared/components/_public_recording_row.html.erb 
b/app/views/shared/components/_public_recording_row.html.erb
index c450eb1..1966cb9 100644
--- a/app/views/shared/components/_public_recording_row.html.erb
+++ b/app/views/shared/components/_public_recording_row.html.erb
@@ -55,9 +55,10 @@
     </div>
   </td>
   <td>
-    <% sorted_formats =  recording[:playbacks].sort_by! {|p| p[:type]} %>
+    <% sorted_formats = recording[:playbacks].sort_by! {|p| p[:type]} %>
     <% p = recording[:playbacks].find do |p| p.key?(:length) end %>
     <% sorted_formats.each do |p| %>
+      <% next if hidden_format_public.include?(p[:type].downcase)%>
       <%= link_to t("recording.format.#{p[:type]}"), p[:url], class: "btn btn-sm btn-primary", target: 
"_blank" %>
     <% end %>
   </td>


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