forked from External/greenlight
GRN2-xx: Email and admin fix (#515)
* Email and admin fix * Redirected super_admins to the admins page * Small fix * Update rooms_controller.rb
This commit is contained in:
committed by
Jesus Federico
parent
63ada8b3db
commit
75bde6a42d
@ -26,6 +26,7 @@ class RoomsController < ApplicationController
|
||||
before_action :verify_room_ownership, except: [:create, :show, :join, :logout]
|
||||
before_action :verify_room_owner_verified, only: [:show, :join],
|
||||
unless: -> { !Rails.configuration.enable_email_verification }
|
||||
before_action :verify_user_not_admin, only: [:show]
|
||||
|
||||
# POST /
|
||||
def create
|
||||
@ -244,11 +245,15 @@ class RoomsController < ApplicationController
|
||||
unless @room.owner.activated?
|
||||
flash[:alert] = t("room.unavailable")
|
||||
|
||||
if current_user
|
||||
if current_user && !@room.owned_by?(current_user)
|
||||
redirect_to current_user.main_room
|
||||
else
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def verify_user_not_admin
|
||||
redirect_to admins_path if current_user && current_user&.has_role?(:super_admin)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user