summaryrefslogtreecommitdiff
path: root/app/controllers/admin
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /app/controllers/admin
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
downloadgitlab-ce-f7d6ced4f57b4920a666336f5a44d098faade2ea.tar.gz
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/abuse_reports_controller.rb2
-rw-r--r--app/controllers/admin/application_settings/appearances_controller.rb1
-rw-r--r--app/controllers/admin/application_settings_controller.rb16
-rw-r--r--app/controllers/admin/background_jobs_controller.rb6
-rw-r--r--app/controllers/admin/background_migrations_controller.rb98
-rw-r--r--app/controllers/admin/batched_jobs_controller.rb34
-rw-r--r--app/controllers/admin/broadcast_messages_controller.rb154
-rw-r--r--app/controllers/admin/ci/variables_controller.rb80
-rw-r--r--app/controllers/admin/groups_controller.rb5
-rw-r--r--app/controllers/admin/plan_limits_controller.rb1
-rw-r--r--app/controllers/admin/projects_controller.rb8
-rw-r--r--app/controllers/admin/spam_logs_controller.rb2
-rw-r--r--app/controllers/admin/system_info_controller.rb10
-rw-r--r--app/controllers/admin/users_controller.rb14
14 files changed, 226 insertions, 205 deletions
diff --git a/app/controllers/admin/abuse_reports_controller.rb b/app/controllers/admin/abuse_reports_controller.rb
index 6f80ed3c172..5357558434e 100644
--- a/app/controllers/admin/abuse_reports_controller.rb
+++ b/app/controllers/admin/abuse_reports_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class Admin::AbuseReportsController < Admin::ApplicationController
- feature_category :users
+ feature_category :insider_threat
def index
@abuse_reports = AbuseReportsFinder.new(params).execute
diff --git a/app/controllers/admin/application_settings/appearances_controller.rb b/app/controllers/admin/application_settings/appearances_controller.rb
index cf765c96a8f..1a8447185a7 100644
--- a/app/controllers/admin/application_settings/appearances_controller.rb
+++ b/app/controllers/admin/application_settings/appearances_controller.rb
@@ -68,6 +68,7 @@ class Admin::ApplicationSettings::AppearancesController < Admin::ApplicationCont
def allowed_appearance_params
%i[
title
+ short_title
description
logo
logo_cache
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index ec9441c2b9b..b8c1bc266f7 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -40,9 +40,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
feature_category :pages, [:lets_encrypt_terms_of_service]
feature_category :error_tracking, [:reset_error_tracking_access_token]
- VALID_SETTING_PANELS = %w(general repository
+ VALID_SETTING_PANELS = %w[general repository
ci_cd reporting metrics_and_profiling
- network preferences).freeze
+ network preferences].freeze
# The current size of a sidekiq job's jid is 24 characters. The size of the
# jid is an internal detail of Sidekiq, and they do not guarantee that it'll
@@ -150,9 +150,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
}
end
- if @application_setting.self_monitoring_project_id.present?
- return render status: :ok, json: self_monitoring_data
- end
+ return render status: :ok, json: self_monitoring_data if @application_setting.self_monitoring_project_id.present?
render status: :bad_request, json: {
message: _('Self-monitoring project does not exist. Please check logs ' \
@@ -236,7 +234,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
params[:application_setting][:restricted_visibility_levels]&.delete("")
if params[:application_setting].key?(:required_instance_ci_template)
- params[:application_setting][:required_instance_ci_template] = nil if params[:application_setting][:required_instance_ci_template].empty?
+ if params[:application_setting][:required_instance_ci_template].empty?
+ params[:application_setting][:required_instance_ci_template] = nil
+ end
end
remove_blank_params_for!(:elasticsearch_aws_secret_access_key, :eks_secret_access_key)
@@ -290,9 +290,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
.new(@application_setting, current_user, application_setting_params)
.execute
- if recheck_user_consent?
- session[:ask_for_usage_stats_consent] = current_user.requires_usage_stats_consent?
- end
+ session[:ask_for_usage_stats_consent] = current_user.requires_usage_stats_consent? if recheck_user_consent?
redirect_path = referer_path(request) || general_admin_application_settings_path
diff --git a/app/controllers/admin/background_jobs_controller.rb b/app/controllers/admin/background_jobs_controller.rb
index 4eda35d66f6..43d2c983823 100644
--- a/app/controllers/admin/background_jobs_controller.rb
+++ b/app/controllers/admin/background_jobs_controller.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
-class Admin::BackgroundJobsController < Admin::ApplicationController
- feature_category :not_owned # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned
+module Admin
+ class BackgroundJobsController < ApplicationController
+ feature_category :not_owned # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned
+ end
end
diff --git a/app/controllers/admin/background_migrations_controller.rb b/app/controllers/admin/background_migrations_controller.rb
index c6c9e0ced22..b904196c5ab 100644
--- a/app/controllers/admin/background_migrations_controller.rb
+++ b/app/controllers/admin/background_migrations_controller.rb
@@ -1,66 +1,68 @@
# frozen_string_literal: true
-class Admin::BackgroundMigrationsController < Admin::ApplicationController
- feature_category :database
- urgency :low
-
- around_action :support_multiple_databases
-
- def index
- @relations_by_tab = {
- 'queued' => batched_migration_class.queued.queue_order,
- 'failed' => batched_migration_class.with_status(:failed).queue_order,
- 'finished' => batched_migration_class.with_status(:finished).queue_order.reverse_order
- }
-
- @current_tab = @relations_by_tab.key?(params[:tab]) ? params[:tab] : 'queued'
- @migrations = @relations_by_tab[@current_tab].page(params[:page])
- @successful_rows_counts = batched_migration_class.successful_rows_counts(@migrations.map(&:id))
- @databases = Gitlab::Database.db_config_names
- end
+module Admin
+ class BackgroundMigrationsController < ApplicationController
+ feature_category :database
+ urgency :low
+
+ around_action :support_multiple_databases
+
+ def index
+ @relations_by_tab = {
+ 'queued' => batched_migration_class.queued.queue_order,
+ 'failed' => batched_migration_class.with_status(:failed).queue_order,
+ 'finished' => batched_migration_class.with_status(:finished).queue_order.reverse_order
+ }
+
+ @current_tab = @relations_by_tab.key?(params[:tab]) ? params[:tab] : 'queued'
+ @migrations = @relations_by_tab[@current_tab].page(params[:page])
+ @successful_rows_counts = batched_migration_class.successful_rows_counts(@migrations.map(&:id))
+ @databases = Gitlab::Database.db_config_names
+ end
- def show
- @migration = batched_migration_class.find(params[:id])
+ def show
+ @migration = batched_migration_class.find(params[:id])
- @failed_jobs = @migration.batched_jobs.with_status(:failed).page(params[:page])
- end
+ @failed_jobs = @migration.batched_jobs.with_status(:failed).page(params[:page])
+ end
- def pause
- migration = batched_migration_class.find(params[:id])
- migration.pause!
+ def pause
+ migration = batched_migration_class.find(params[:id])
+ migration.pause!
- redirect_back fallback_location: { action: 'index' }
- end
+ redirect_back fallback_location: { action: 'index' }
+ end
- def resume
- migration = batched_migration_class.find(params[:id])
- migration.execute!
+ def resume
+ migration = batched_migration_class.find(params[:id])
+ migration.execute!
- redirect_back fallback_location: { action: 'index' }
- end
+ redirect_back fallback_location: { action: 'index' }
+ end
- def retry
- migration = batched_migration_class.find(params[:id])
- migration.retry_failed_jobs! if migration.failed?
+ def retry
+ migration = batched_migration_class.find(params[:id])
+ migration.retry_failed_jobs! if migration.failed?
- redirect_back fallback_location: { action: 'index' }
- end
+ redirect_back fallback_location: { action: 'index' }
+ end
- private
+ private
- def support_multiple_databases
- Gitlab::Database::SharedModel.using_connection(base_model.connection) do
- yield
+ def support_multiple_databases
+ Gitlab::Database::SharedModel.using_connection(base_model.connection) do
+ yield
+ end
end
- end
- def base_model
- @selected_database = params[:database] || Gitlab::Database::MAIN_DATABASE_NAME
+ def base_model
+ @selected_database = params[:database] || Gitlab::Database::MAIN_DATABASE_NAME
- Gitlab::Database.database_base_models[@selected_database]
- end
+ Gitlab::Database.database_base_models[@selected_database]
+ end
- def batched_migration_class
- @batched_migration_class ||= Gitlab::Database::BackgroundMigration::BatchedMigration
+ def batched_migration_class
+ @batched_migration_class ||= Gitlab::Database::BackgroundMigration::BatchedMigration
+ end
end
end
diff --git a/app/controllers/admin/batched_jobs_controller.rb b/app/controllers/admin/batched_jobs_controller.rb
index 0a00ba13dc8..10b5f68d630 100644
--- a/app/controllers/admin/batched_jobs_controller.rb
+++ b/app/controllers/admin/batched_jobs_controller.rb
@@ -1,28 +1,30 @@
# frozen_string_literal: true
-class Admin::BatchedJobsController < Admin::ApplicationController
- feature_category :database
- urgency :low
+module Admin
+ class BatchedJobsController < ApplicationController
+ feature_category :database
+ urgency :low
- around_action :support_multiple_databases
+ around_action :support_multiple_databases
- def show
- @job = Gitlab::Database::BackgroundMigration::BatchedJob.find(params[:id])
+ def show
+ @job = Gitlab::Database::BackgroundMigration::BatchedJob.find(params[:id])
- @transition_logs = @job.batched_job_transition_logs
- end
+ @transition_logs = @job.batched_job_transition_logs
+ end
- private
+ private
- def support_multiple_databases
- Gitlab::Database::SharedModel.using_connection(base_model.connection) do
- yield
+ def support_multiple_databases
+ Gitlab::Database::SharedModel.using_connection(base_model.connection) do
+ yield
+ end
end
- end
- def base_model
- @selected_database = params[:database] || Gitlab::Database::MAIN_DATABASE_NAME
+ def base_model
+ @selected_database = params[:database] || Gitlab::Database::MAIN_DATABASE_NAME
- Gitlab::Database.database_base_models[@selected_database]
+ Gitlab::Database.database_base_models[@selected_database]
+ end
end
end
diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb
index bdf0c6aedb9..093c5667a24 100644
--- a/app/controllers/admin/broadcast_messages_controller.rb
+++ b/app/controllers/admin/broadcast_messages_controller.rb
@@ -1,104 +1,106 @@
# frozen_string_literal: true
-class Admin::BroadcastMessagesController < Admin::ApplicationController
- include BroadcastMessagesHelper
+module Admin
+ class BroadcastMessagesController < ApplicationController
+ include BroadcastMessagesHelper
- before_action :find_broadcast_message, only: [:edit, :update, :destroy]
- before_action :find_broadcast_messages, only: [:index, :create]
- before_action :push_features, only: [:index, :edit]
+ before_action :find_broadcast_message, only: [:edit, :update, :destroy]
+ before_action :find_broadcast_messages, only: [:index, :create]
+ before_action :push_features, only: [:index, :edit]
- feature_category :onboarding
- urgency :low
+ feature_category :onboarding
+ urgency :low
- def index
- @broadcast_message = BroadcastMessage.new
- end
-
- def edit
- end
+ def index
+ @broadcast_message = BroadcastMessage.new
+ end
- def create
- @broadcast_message = BroadcastMessage.new(broadcast_message_params)
- success = @broadcast_message.save
+ def edit
+ end
- respond_to do |format|
- format.json do
- if success
- render json: @broadcast_message, status: :ok
- else
- render json: { errors: @broadcast_message.errors.full_messages }, status: :bad_request
+ def create
+ @broadcast_message = BroadcastMessage.new(broadcast_message_params)
+ success = @broadcast_message.save
+
+ respond_to do |format|
+ format.json do
+ if success
+ render json: @broadcast_message, status: :ok
+ else
+ render json: { errors: @broadcast_message.errors.full_messages }, status: :bad_request
+ end
end
- end
- format.html do
- if success
- redirect_to admin_broadcast_messages_path, notice: _('Broadcast Message was successfully created.')
- else
- render :index
+ format.html do
+ if success
+ redirect_to admin_broadcast_messages_path, notice: _('Broadcast Message was successfully created.')
+ else
+ render :index
+ end
end
end
end
- end
- def update
- success = @broadcast_message.update(broadcast_message_params)
+ def update
+ success = @broadcast_message.update(broadcast_message_params)
- respond_to do |format|
- format.json do
- if success
- render json: @broadcast_message, status: :ok
- else
- render json: { errors: @broadcast_message.errors.full_messages }, status: :bad_request
+ respond_to do |format|
+ format.json do
+ if success
+ render json: @broadcast_message, status: :ok
+ else
+ render json: { errors: @broadcast_message.errors.full_messages }, status: :bad_request
+ end
end
- end
- format.html do
- if success
- redirect_to admin_broadcast_messages_path, notice: _('Broadcast Message was successfully updated.')
- else
- render :edit
+ format.html do
+ if success
+ redirect_to admin_broadcast_messages_path, notice: _('Broadcast Message was successfully updated.')
+ else
+ render :edit
+ end
end
end
end
- end
- def destroy
- @broadcast_message.destroy
+ def destroy
+ @broadcast_message.destroy
- respond_to do |format|
- format.html { redirect_back_or_default(default: { action: 'index' }) }
- format.js { head :ok }
+ respond_to do |format|
+ format.html { redirect_back_or_default(default: { action: 'index' }) }
+ format.js { head :ok }
+ end
end
- end
- def preview
- @broadcast_message = BroadcastMessage.new(broadcast_message_params)
- render partial: 'admin/broadcast_messages/preview'
- end
+ def preview
+ @broadcast_message = BroadcastMessage.new(broadcast_message_params)
+ render partial: 'admin/broadcast_messages/preview'
+ end
- protected
+ protected
- def find_broadcast_message
- @broadcast_message = BroadcastMessage.find(params[:id])
- end
+ def find_broadcast_message
+ @broadcast_message = BroadcastMessage.find(params[:id])
+ end
- def find_broadcast_messages
- @broadcast_messages = BroadcastMessage.order(ends_at: :desc).page(params[:page]) # rubocop: disable CodeReuse/ActiveRecord
- end
+ def find_broadcast_messages
+ @broadcast_messages = BroadcastMessage.order(ends_at: :desc).page(params[:page]) # rubocop: disable CodeReuse/ActiveRecord
+ end
- def broadcast_message_params
- params.require(:broadcast_message)
- .permit(%i(
- theme
- ends_at
- message
- starts_at
- target_path
- broadcast_type
- dismissable
- ), target_access_levels: []).reverse_merge!(target_access_levels: [])
- end
+ def broadcast_message_params
+ params.require(:broadcast_message)
+ .permit(%i[
+ theme
+ ends_at
+ message
+ starts_at
+ target_path
+ broadcast_type
+ dismissable
+ ], target_access_levels: []).reverse_merge!(target_access_levels: [])
+ end
- def push_features
- push_frontend_feature_flag(:vue_broadcast_messages, current_user)
- push_frontend_feature_flag(:role_targeted_broadcast_messages, current_user)
+ def push_features
+ push_frontend_feature_flag(:vue_broadcast_messages, current_user)
+ push_frontend_feature_flag(:role_targeted_broadcast_messages, current_user)
+ end
end
end
diff --git a/app/controllers/admin/ci/variables_controller.rb b/app/controllers/admin/ci/variables_controller.rb
index 7d643435ddb..ef50d7362c4 100644
--- a/app/controllers/admin/ci/variables_controller.rb
+++ b/app/controllers/admin/ci/variables_controller.rb
@@ -1,50 +1,54 @@
# frozen_string_literal: true
-class Admin::Ci::VariablesController < Admin::ApplicationController
- feature_category :pipeline_authoring
-
- def show
- respond_to do |format|
- format.json { render_instance_variables }
- end
- end
-
- def update
- service = Ci::UpdateInstanceVariablesService.new(variables_params)
-
- if service.execute
- respond_to do |format|
- format.json { render_instance_variables }
+module Admin
+ module Ci
+ class VariablesController < ApplicationController
+ feature_category :pipeline_authoring
+
+ def show
+ respond_to do |format|
+ format.json { render_instance_variables }
+ end
end
- else
- respond_to do |format|
- format.json { render_error(service.errors) }
+
+ def update
+ service = ::Ci::UpdateInstanceVariablesService.new(variables_params)
+
+ if service.execute
+ respond_to do |format|
+ format.json { render_instance_variables }
+ end
+ else
+ respond_to do |format|
+ format.json { render_error(service.errors) }
+ end
+ end
end
- end
- end
- private
+ private
- def variables
- @variables ||= Ci::InstanceVariable.all
- end
+ def variables
+ @variables ||= ::Ci::InstanceVariable.all
+ end
- def render_instance_variables
- render status: :ok,
- json: {
- variables: Ci::InstanceVariableSerializer.new.represent(variables)
- }
- end
+ def render_instance_variables
+ render status: :ok,
+ json: {
+ variables: ::Ci::InstanceVariableSerializer.new.represent(variables)
+ }
+ end
- def render_error(errors)
- render status: :bad_request, json: errors
- end
+ def render_error(errors)
+ render status: :bad_request, json: errors
+ end
- def variables_params
- params.permit(variables_attributes: Array(variable_params_attributes))
- end
+ def variables_params
+ params.permit(variables_attributes: Array(variable_params_attributes))
+ end
- def variable_params_attributes
- %i[id variable_type key secret_value protected masked _destroy]
+ def variable_params_attributes
+ %i[id variable_type key secret_value protected masked raw _destroy]
+ end
+ end
end
end
diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb
index 1395d4bb3b7..8005babe19e 100644
--- a/app/controllers/admin/groups_controller.rb
+++ b/app/controllers/admin/groups_controller.rb
@@ -51,6 +51,10 @@ class Admin::GroupsController < Admin::ApplicationController
@group.build_admin_note unless @group.admin_note
if @group.update(group_params)
+ unless Gitlab::Utils.to_boolean(group_params['runner_registration_enabled'])
+ Ci::Runners::ResetRegistrationTokenService.new(@group, current_user).execute
+ end
+
redirect_to [:admin, @group], notice: _('Group was successfully updated.')
else
render "edit"
@@ -91,6 +95,7 @@ class Admin::GroupsController < Admin::ApplicationController
:name,
:path,
:request_access_enabled,
+ :runner_registration_enabled,
:visibility_level,
:require_two_factor_authentication,
:two_factor_grace_period,
diff --git a/app/controllers/admin/plan_limits_controller.rb b/app/controllers/admin/plan_limits_controller.rb
index 2cebc059830..ea52198432c 100644
--- a/app/controllers/admin/plan_limits_controller.rb
+++ b/app/controllers/admin/plan_limits_controller.rb
@@ -47,6 +47,7 @@ class Admin::PlanLimitsController < Admin::ApplicationController
ci_needs_size_limit
ci_registered_group_runners
ci_registered_project_runners
+ pipeline_hierarchy_size
])
end
end
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb
index 3f3c3581555..9e841487508 100644
--- a/app/controllers/admin/projects_controller.rb
+++ b/app/controllers/admin/projects_controller.rb
@@ -13,9 +13,7 @@ class Admin::ProjectsController < Admin::ApplicationController
params[:sort] ||= 'latest_activity_desc'
@sort = params[:sort]
- if params[:last_repository_check_failed].present? && params[:archived].nil?
- params[:archived] = true
- end
+ params[:archived] = true if params[:last_repository_check_failed].present? && params[:archived].nil?
@projects = Admin::ProjectsFinder.new(params: params, current_user: current_user).execute
@@ -57,9 +55,7 @@ class Admin::ProjectsController < Admin::ApplicationController
namespace = Namespace.find_by(id: params[:new_namespace_id])
::Projects::TransferService.new(@project, current_user, params.dup).execute(namespace)
- if @project.errors[:new_namespace].present?
- flash[:alert] = @project.errors[:new_namespace].first
- end
+ flash[:alert] = @project.errors[:new_namespace].first if @project.errors[:new_namespace].present?
@project.reset
redirect_to admin_project_path(@project)
diff --git a/app/controllers/admin/spam_logs_controller.rb b/app/controllers/admin/spam_logs_controller.rb
index 3a55fc4b951..180f4634136 100644
--- a/app/controllers/admin/spam_logs_controller.rb
+++ b/app/controllers/admin/spam_logs_controller.rb
@@ -5,7 +5,7 @@ class Admin::SpamLogsController < Admin::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def index
- @spam_logs = SpamLog.order(id: :desc).page(params[:page])
+ @spam_logs = SpamLog.includes(:user).order(id: :desc).page(params[:page])
end
# rubocop: enable CodeReuse/ActiveRecord
diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb
index 41f95addc66..96fb73cedfe 100644
--- a/app/controllers/admin/system_info_controller.rb
+++ b/app/controllers/admin/system_info_controller.rb
@@ -59,11 +59,11 @@ class Admin::SystemInfoController < Admin::ApplicationController
begin
disk = Sys::Filesystem.stat(mount.mount_point)
@disks.push({
- bytes_total: disk.bytes_total,
- bytes_used: disk.bytes_used,
- disk_name: mount.name,
- mount_path: disk.path
- })
+ bytes_total: disk.bytes_total,
+ bytes_used: disk.bytes_used,
+ disk_name: mount.name,
+ mount_path: disk.path
+ })
rescue Sys::Filesystem::Error
end
end
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 2c8b4888d5d..5f6e3f0062f 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -88,17 +88,25 @@ class Admin::UsersController < Admin::ApplicationController
end
def activate
- return redirect_back_or_admin_user(notice: _("Error occurred. A blocked user must be unblocked to be activated")) if user.blocked?
+ if user.blocked?
+ return redirect_back_or_admin_user(notice: _("Error occurred. A blocked user must be unblocked to be activated"))
+ end
user.activate
redirect_back_or_admin_user(notice: _("Successfully activated"))
end
def deactivate
- return redirect_back_or_admin_user(notice: _("Error occurred. A blocked user cannot be deactivated")) if user.blocked?
+ if user.blocked?
+ return redirect_back_or_admin_user(notice: _("Error occurred. A blocked user cannot be deactivated"))
+ end
+
return redirect_back_or_admin_user(notice: _("Successfully deactivated")) if user.deactivated?
return redirect_back_or_admin_user(notice: _("Internal users cannot be deactivated")) if user.internal?
- return redirect_back_or_admin_user(notice: _("The user you are trying to deactivate has been active in the past %{minimum_inactive_days} days and cannot be deactivated") % { minimum_inactive_days: Gitlab::CurrentSettings.deactivate_dormant_users_period }) unless user.can_be_deactivated?
+
+ unless user.can_be_deactivated?
+ return redirect_back_or_admin_user(notice: _("The user you are trying to deactivate has been active in the past %{minimum_inactive_days} days and cannot be deactivated") % { minimum_inactive_days: Gitlab::CurrentSettings.deactivate_dormant_users_period })
+ end
user.deactivate
redirect_back_or_admin_user(notice: _("Successfully deactivated"))