forked from External/greenlight
GRN2-268: Fixed redirection after executing an action in Manage Users (#967)
* GRN2-268: Fixed redirection after executing an action in Manage Users * GRN2-268: rubocop fix
This commit is contained in:
parent
50f4d5e4f8
commit
edcda54f89
|
@ -178,7 +178,7 @@ class AdminsController < ApplicationController
|
|||
flash[:success] = I18n.t("administrator.flash.merge_success")
|
||||
end
|
||||
|
||||
redirect_to admins_path
|
||||
redirect_back fallback_location: admins_path
|
||||
end
|
||||
|
||||
# SITE SETTINGS
|
||||
|
|
|
@ -132,12 +132,13 @@ class UsersController < ApplicationController
|
|||
# DELETE /u/:user_uid
|
||||
def destroy
|
||||
# Include deleted users in the check
|
||||
admin_path = request.referer.present? ? request.referer : admins_path
|
||||
@user = User.include_deleted.find_by(uid: params[:user_uid])
|
||||
|
||||
logger.info "Support: #{current_user.email} is deleting #{@user.email}."
|
||||
|
||||
self_delete = current_user == @user
|
||||
redirect_url = self_delete ? root_path : admins_path
|
||||
redirect_url = self_delete ? root_path : admin_path
|
||||
|
||||
begin
|
||||
if current_user && (self_delete || current_user.admin_of?(@user))
|
||||
|
|
Loading…
Reference in New Issue