forked from External/greenlight
Add setting for recording visibility (#634)
This commit is contained in:
parent
2c37f87cbc
commit
c4eeee3d40
|
@ -24,7 +24,7 @@ class AdminsController < ApplicationController
|
||||||
|
|
||||||
manage_users = [:edit_user, :promote, :demote, :ban_user, :unban_user, :approve]
|
manage_users = [:edit_user, :promote, :demote, :ban_user, :unban_user, :approve]
|
||||||
site_settings = [:branding, :coloring, :coloring_lighten, :coloring_darken,
|
site_settings = [:branding, :coloring, :coloring_lighten, :coloring_darken,
|
||||||
:registration_method, :room_authentication, :room_limit]
|
:registration_method, :room_authentication, :room_limit, :default_recording_visibility]
|
||||||
|
|
||||||
authorize_resource class: false
|
authorize_resource class: false
|
||||||
before_action :find_user, only: manage_users
|
before_action :find_user, only: manage_users
|
||||||
|
@ -176,6 +176,13 @@ class AdminsController < ApplicationController
|
||||||
redirect_to admin_site_settings_path, flash: { success: I18n.t("administrator.flash.settings") }
|
redirect_to admin_site_settings_path, flash: { success: I18n.t("administrator.flash.settings") }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# POST /admins/default_recording_visibility
|
||||||
|
def default_recording_visibility
|
||||||
|
@settings.update_value("Default Recording Visibility", params[:visibility])
|
||||||
|
redirect_to admins_path, flash: { success: I18n.t("administrator.flash.settings") + ". " +
|
||||||
|
I18n.t("administrator.site_settings.recording_visibility.warning") }
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_user
|
def find_user
|
||||||
|
|
|
@ -106,6 +106,8 @@ class ApplicationController < ActionController::Base
|
||||||
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: true,
|
||||||
moderator_message: "#{invite_msg}\n\n#{request.base_url + room_path(@room)}",
|
moderator_message: "#{invite_msg}\n\n#{request.base_url + room_path(@room)}",
|
||||||
|
recording_default_visibility: Setting.find_or_create_by!(provider: user_settings_provider)
|
||||||
|
.get_value("Default Recording Visibility") == "public"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,15 @@ module AdminsHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def recording_default_visibility_string
|
||||||
|
if Setting.find_or_create_by!(provider: user_settings_provider)
|
||||||
|
.get_value("Default Recording Visibility") == "public"
|
||||||
|
I18n.t("administrator.site_settings.recording_visibility.public")
|
||||||
|
else
|
||||||
|
I18n.t("administrator.site_settings.recording_visibility.private")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def registration_method_string
|
def registration_method_string
|
||||||
case registration_method
|
case registration_method
|
||||||
when Rails.configuration.registration_methods[:open]
|
when Rails.configuration.registration_methods[:open]
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Room < ApplicationRecord
|
||||||
attendeePW: attendee_pw,
|
attendeePW: attendee_pw,
|
||||||
moderatorOnlyMessage: options[:moderator_message],
|
moderatorOnlyMessage: options[:moderator_message],
|
||||||
muteOnStart: options[:mute_on_start] || false,
|
muteOnStart: options[:mute_on_start] || false,
|
||||||
"meta_#{META_LISTED}": false,
|
"meta_#{META_LISTED}": options[:recording_default_visibility] || false
|
||||||
}
|
}
|
||||||
|
|
||||||
# Send the create request.
|
# Send the create request.
|
||||||
|
|
|
@ -98,6 +98,27 @@
|
||||||
</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("administrator.site_settings.recording_visibility.title") %></label>
|
||||||
|
<label class="form-label text-muted"><%= t("administrator.site_settings.recording_visibility.info") %></label>
|
||||||
|
<div class="dropdown">
|
||||||
|
<button class="btn btn-primary dropdown-toggle" type="button" id="room-auth" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
<%= recording_default_visibility_string %>
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-menu" aria-labelledby="room-auth">
|
||||||
|
<%= button_to admin_recording_visibility_path(visibility: "public"), class: "dropdown-item" do %>
|
||||||
|
<%= t("administrator.site_settings.recording_visibility.public") %>
|
||||||
|
<% end %>
|
||||||
|
<%= button_to admin_recording_visibility_path(visibility: "private"), class: "dropdown-item" do %>
|
||||||
|
<%= t("administrator.site_settings.recording_visibility.private") %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
|
@ -48,6 +48,12 @@ en:
|
||||||
regular: Regular
|
regular: Regular
|
||||||
lighten: Lighten
|
lighten: Lighten
|
||||||
Darken: Darken
|
Darken: Darken
|
||||||
|
recording_visibility:
|
||||||
|
public: Public
|
||||||
|
private: Private
|
||||||
|
info: Set the default recording visbility for new recordings
|
||||||
|
title: Recording Default Visibility
|
||||||
|
warning: This setting will only be applied to rooms that aren't running
|
||||||
registration:
|
registration:
|
||||||
info: Change the way that users register to the website
|
info: Change the way that users register to the website
|
||||||
title: Registration Method
|
title: Registration Method
|
||||||
|
|
|
@ -54,6 +54,7 @@ Rails.application.routes.draw do
|
||||||
post '/registration_method/:method', to: 'admins#registration_method', as: :admin_change_registration
|
post '/registration_method/:method', to: 'admins#registration_method', as: :admin_change_registration
|
||||||
post '/approve/:user_uid', to: 'admins#approve', as: :admin_approve
|
post '/approve/:user_uid', to: 'admins#approve', as: :admin_approve
|
||||||
post '/room_limit', to: 'admins#room_limit', as: :admin_room_limit
|
post '/room_limit', to: 'admins#room_limit', as: :admin_room_limit
|
||||||
|
post '/default_recording_visibility', to: 'admins#default_recording_visibility', as: :admin_recording_visibility
|
||||||
end
|
end
|
||||||
|
|
||||||
scope '/themes' do
|
scope '/themes' do
|
||||||
|
|
|
@ -312,5 +312,21 @@ describe AdminsController, type: :controller do
|
||||||
expect(response).to redirect_to(admin_site_settings_path)
|
expect(response).to redirect_to(admin_site_settings_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "POST #default_recording_visibility" do
|
||||||
|
it "changes the default recording visibility setting" do
|
||||||
|
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
|
||||||
|
allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
|
||||||
|
|
||||||
|
@request.session[:user_id] = @admin.id
|
||||||
|
|
||||||
|
post :default_recording_visibility, params: { visibility: "public" }
|
||||||
|
|
||||||
|
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Default Recording Visibility")
|
||||||
|
|
||||||
|
expect(feature[:value]).to eq("public")
|
||||||
|
expect(response).to redirect_to(admins_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue