From edcda54f898410bb4a4a8fe097aab0af10fc0b56 Mon Sep 17 00:00:00 2001 From: etiennevvv <59622352+etiennevvv@users.noreply.github.com> Date: Fri, 28 Feb 2020 11:32:32 -0500 Subject: [PATCH] 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 --- app/controllers/admins_controller.rb | 2 +- app/controllers/users_controller.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/admins_controller.rb b/app/controllers/admins_controller.rb index 6df1916954..ddef4f5f7c 100644 --- a/app/controllers/admins_controller.rb +++ b/app/controllers/admins_controller.rb @@ -178,7 +178,7 @@ def merge_user flash[:success] = I18n.t("administrator.flash.merge_success") end - redirect_to admins_path + redirect_back fallback_location: admins_path end # SITE SETTINGS diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9b6a261317..3779c55ece 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -132,12 +132,13 @@ def update # 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))