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:
etiennevvv 2020-02-28 11:32:32 -05:00 committed by GitHub
parent 50f4d5e4f8
commit edcda54f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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))