Merge branch 'v2.2.1-alpha' into master

This commit is contained in:
Jesus Federico
2019-07-23 15:57:08 -04:00
committed by GitHub
77 changed files with 1740 additions and 921 deletions

View File

@ -19,6 +19,18 @@
module AdminsHelper
include Pagy::Frontend
# Returns the action method of the current page
def active_page
route = Rails.application.routes.recognize_path(request.env['PATH_INFO'])
route[:action]
end
# Gets the email of the room owner to which the recording belongs to
def recording_owner_email(room_id)
Room.find_by(bbb_id: room_id).owner.email
end
def display_invite
current_page?(admins_path) && invite_registration
end
@ -43,6 +55,15 @@ module AdminsHelper
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
case registration_method
when Rails.configuration.registration_methods[:open]

View File

@ -107,7 +107,7 @@ module ApplicationHelper
# Returns the page that the logo redirects to when clicked on
def home_page
return root_path unless current_user
return admins_path if current_user.has_role? :super_admin
return admins_path if current_user.has_cached_role? :super_admin
current_user.main_room
end
end

View File

@ -37,7 +37,7 @@ module RoomsHelper
# Does not apply to admin or users that aren't signed in
# 15+ option is used as unlimited
return false if current_user&.has_role?(:admin) || limit == 15
return false if current_user&.has_cached_role?(:admin) || limit == 15
current_user.rooms.length >= limit
end
@ -46,7 +46,7 @@ module RoomsHelper
# Get how many rooms need to be deleted to reach allowed room number
limit = Setting.find_or_create_by!(provider: user_settings_provider).get_value("Room Limit").to_i
return false if current_user&.has_role?(:admin) || limit == 15
return false if current_user&.has_cached_role?(:admin) || limit == 15
@diff = current_user.rooms.count - limit
@diff.positive? && current_user.rooms.pluck(:id).index(room.id) + 1 > limit

View File

@ -61,7 +61,17 @@ module SessionsHelper
# Retrieves the current user.
def current_user
@current_user ||= User.find_by(id: session[:user_id])
@current_user ||= User.where(id: session[:user_id]).includes(:roles).first
if Rails.configuration.loadbalanced_configuration
if @current_user && !@current_user.has_role?(:super_admin) &&
@current_user.provider != @user_domain
@current_user = nil
session.clear
end
end
@current_user
end
def generate_checksum(user_domain, redirect_url, secret)

View File

@ -31,7 +31,7 @@ module ThemingHelper
# Returns the user's provider in the settings context
def user_settings_provider
if Rails.configuration.loadbalanced_configuration && current_user && !current_user&.has_role?(:super_admin)
if Rails.configuration.loadbalanced_configuration && current_user && !current_user&.has_cached_role?(:super_admin)
current_user.provider
elsif Rails.configuration.loadbalanced_configuration
@user_domain