summaryrefslogtreecommitdiff
path: root/app/controllers/admin
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/admin')
-rw-r--r--app/controllers/admin/appearances_controller.rb16
-rw-r--r--app/controllers/admin/application_controller.rb2
-rw-r--r--app/controllers/admin/application_settings_controller.rb12
-rw-r--r--app/controllers/admin/applications_controller.rb4
-rw-r--r--app/controllers/admin/broadcast_messages_controller.rb12
-rw-r--r--app/controllers/admin/dashboard_controller.rb2
-rw-r--r--app/controllers/admin/deploy_keys_controller.rb6
-rw-r--r--app/controllers/admin/groups_controller.rb18
-rw-r--r--app/controllers/admin/health_check_controller.rb2
-rw-r--r--app/controllers/admin/hooks_controller.rb6
-rw-r--r--app/controllers/admin/identities_controller.rb8
-rw-r--r--app/controllers/admin/impersonation_tokens_controller.rb6
-rw-r--r--app/controllers/admin/impersonations_controller.rb2
-rw-r--r--app/controllers/admin/jobs_controller.rb8
-rw-r--r--app/controllers/admin/keys_controller.rb4
-rw-r--r--app/controllers/admin/labels_controller.rb4
-rw-r--r--app/controllers/admin/logs_controller.rb2
-rw-r--r--app/controllers/admin/projects_controller.rb17
-rw-r--r--app/controllers/admin/requests_profiles_controller.rb2
-rw-r--r--app/controllers/admin/runner_projects_controller.rb4
-rw-r--r--app/controllers/admin/runners_controller.rb12
-rw-r--r--app/controllers/admin/services_controller.rb4
-rw-r--r--app/controllers/admin/spam_logs_controller.rb8
-rw-r--r--app/controllers/admin/system_info_controller.rb68
-rw-r--r--app/controllers/admin/users_controller.rb22
25 files changed, 132 insertions, 119 deletions
diff --git a/app/controllers/admin/appearances_controller.rb b/app/controllers/admin/appearances_controller.rb
index 189fee98aa0..664bb99c95c 100644
--- a/app/controllers/admin/appearances_controller.rb
+++ b/app/controllers/admin/appearances_controller.rb
@@ -7,24 +7,24 @@ class Admin::AppearancesController < Admin::ApplicationController
end
def preview_sign_in
- render 'preview_sign_in', layout: 'devise'
+ render "preview_sign_in", layout: "devise"
end
def create
@appearance = Appearance.new(appearance_params)
if @appearance.save
- redirect_to admin_appearances_path, notice: 'Appearance was successfully created.'
+ redirect_to admin_appearances_path, notice: "Appearance was successfully created."
else
- render action: 'show'
+ render action: "show"
end
end
def update
if @appearance.update(appearance_params)
- redirect_to admin_appearances_path, notice: 'Appearance was successfully updated.'
+ redirect_to admin_appearances_path, notice: "Appearance was successfully updated."
else
- render action: 'show'
+ render action: "show"
end
end
@@ -33,21 +33,21 @@ class Admin::AppearancesController < Admin::ApplicationController
@appearance.save
- redirect_to admin_appearances_path, notice: 'Logo was successfully removed.'
+ redirect_to admin_appearances_path, notice: "Logo was successfully removed."
end
def header_logos
@appearance.remove_header_logo!
@appearance.save
- redirect_to admin_appearances_path, notice: 'Header logo was successfully removed.'
+ redirect_to admin_appearances_path, notice: "Header logo was successfully removed."
end
def favicon
@appearance.remove_favicon!
@appearance.save
- redirect_to admin_appearances_path, notice: 'Favicon was successfully removed.'
+ redirect_to admin_appearances_path, notice: "Favicon was successfully removed."
end
private
diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb
index ef182b981f1..2466b8c68df 100644
--- a/app/controllers/admin/application_controller.rb
+++ b/app/controllers/admin/application_controller.rb
@@ -5,7 +5,7 @@
# Automatically sets the layout and ensures an administrator is logged in
class Admin::ApplicationController < ApplicationController
before_action :authenticate_admin!
- layout 'admin'
+ layout "admin"
def authenticate_admin!
render_404 unless current_user.admin?
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index 8f267eccc8a..eb8fddbb626 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -48,7 +48,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
respond_to do |format|
if successful
format.json { head :ok }
- format.html { redirect_to redirect_path, notice: 'Application settings saved successfully' }
+ format.html { redirect_to redirect_path, notice: "Application settings saved successfully" }
else
format.json { head :bad_request }
format.html { render :show }
@@ -61,7 +61,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
format.html do
usage_data_json = JSON.pretty_generate(Gitlab::UsageData.data)
- render html: Gitlab::Highlight.highlight('payload.json', usage_data_json, language: 'json')
+ render html: Gitlab::Highlight.highlight("payload.json", usage_data_json, language: "json")
end
format.json { render json: Gitlab::UsageData.to_json }
end
@@ -70,13 +70,13 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
def reset_registration_token
@application_setting.reset_runners_registration_token!
- flash[:notice] = 'New runners registration token has been generated!'
+ flash[:notice] = "New runners registration token has been generated!"
redirect_to admin_runners_path
end
def reset_health_check_token
@application_setting.reset_health_check_access_token!
- flash[:notice] = 'New health check access token has been generated!'
+ flash[:notice] = "New health check access token has been generated!"
redirect_back_or_default
end
@@ -85,7 +85,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
redirect_to(
admin_application_settings_path,
- notice: 'Started asynchronous removal of all repository check states.'
+ notice: "Started asynchronous removal of all repository check states."
)
end
@@ -129,7 +129,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
disabled_oauth_sign_in_sources: [],
import_sources: [],
repository_storages: [],
- restricted_visibility_levels: []
+ restricted_visibility_levels: [],
]
end
end
diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb
index 6fc336714b6..6489fa8f376 100644
--- a/app/controllers/admin/applications_controller.rb
+++ b/app/controllers/admin/applications_controller.rb
@@ -34,7 +34,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
def update
if @application.update(application_params)
- redirect_to admin_application_path(@application), notice: 'Application was successfully updated.'
+ redirect_to admin_application_path(@application), notice: "Application was successfully updated."
else
render :edit
end
@@ -42,7 +42,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
def destroy
@application.destroy
- redirect_to admin_applications_url, status: 302, notice: 'Application was successfully destroyed.'
+ redirect_to admin_applications_url, status: 302, notice: "Application was successfully destroyed."
end
private
diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb
index a91d9a534cd..dbd3469f232 100644
--- a/app/controllers/admin/broadcast_messages_controller.rb
+++ b/app/controllers/admin/broadcast_messages_controller.rb
@@ -19,7 +19,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
@broadcast_message = BroadcastMessage.new(broadcast_message_params)
if @broadcast_message.save
- redirect_to admin_broadcast_messages_path, notice: 'Broadcast Message was successfully created.'
+ redirect_to admin_broadcast_messages_path, notice: "Broadcast Message was successfully created."
else
render :index
end
@@ -27,7 +27,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
def update
if @broadcast_message.update(broadcast_message_params)
- redirect_to admin_broadcast_messages_path, notice: 'Broadcast Message was successfully updated.'
+ redirect_to admin_broadcast_messages_path, notice: "Broadcast Message was successfully updated."
else
render :edit
end
@@ -37,14 +37,14 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
@broadcast_message.destroy
respond_to do |format|
- format.html { redirect_back_or_default(default: { action: 'index' }) }
+ format.html { redirect_back_or_default(default: {action: "index"}) }
format.js { head :ok }
end
end
def preview
broadcast_message = BroadcastMessage.new(broadcast_message_params)
- render json: { message: render_broadcast_message(broadcast_message) }
+ render json: {message: render_broadcast_message(broadcast_message)}
end
protected
@@ -54,12 +54,12 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
end
def broadcast_message_params
- params.require(:broadcast_message).permit(%i(
+ params.require(:broadcast_message).permit(%i[
color
ends_at
font
message
starts_at
- ))
+ ])
end
end
diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb
index 23cc9ee247a..b59844bff58 100644
--- a/app/controllers/admin/dashboard_controller.rb
+++ b/app/controllers/admin/dashboard_controller.rb
@@ -4,7 +4,7 @@ class Admin::DashboardController < Admin::ApplicationController
include CountHelper
COUNTED_ITEMS = [Project, User, Group, ForkNetworkMember, ForkNetwork, Issue,
- MergeRequest, Note, Snippet, Key, Milestone].freeze
+ MergeRequest, Note, Snippet, Key, Milestone,].freeze
# rubocop: disable CodeReuse/ActiveRecord
def index
diff --git a/app/controllers/admin/deploy_keys_controller.rb b/app/controllers/admin/deploy_keys_controller.rb
index 49ce275ad14..c76adcc1852 100644
--- a/app/controllers/admin/deploy_keys_controller.rb
+++ b/app/controllers/admin/deploy_keys_controller.rb
@@ -16,7 +16,7 @@ class Admin::DeployKeysController < Admin::ApplicationController
if @deploy_key.persisted?
redirect_to admin_deploy_keys_path
else
- render 'new'
+ render "new"
end
end
@@ -25,10 +25,10 @@ class Admin::DeployKeysController < Admin::ApplicationController
def update
if deploy_key.update(update_params)
- flash[:notice] = 'Deploy key was successfully updated.'
+ flash[:notice] = "Deploy key was successfully updated."
redirect_to admin_deploy_keys_path
else
- render 'edit'
+ render "edit"
end
end
diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb
index 46e85e1424f..a2f3b2b8e52 100644
--- a/app/controllers/admin/groups_controller.rb
+++ b/app/controllers/admin/groups_controller.rb
@@ -14,11 +14,13 @@ class Admin::GroupsController < Admin::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def show
- @group = Group.with_statistics.joins(:route).group('routes.path').find_by_full_path(params[:id])
+ @group = Group.with_statistics.joins(:route).group("routes.path").find_by_full_path(params[:id])
@members = present_members(
- @group.members.order("access_level DESC").page(params[:members_page]))
+ @group.members.order("access_level DESC").page(params[:members_page])
+ )
@requesters = present_members(
- AccessRequestsFinder.new(@group).execute(current_user))
+ AccessRequestsFinder.new(@group).execute(current_user)
+ )
@projects = @group.projects.with_statistics.page(params[:projects_page])
end
# rubocop: enable CodeReuse/ActiveRecord
@@ -44,7 +46,7 @@ class Admin::GroupsController < Admin::ApplicationController
def update
if @group.update(group_params)
- redirect_to [:admin, @group], notice: 'Group was successfully updated.'
+ redirect_to [:admin, @group], notice: "Group was successfully updated."
else
render "edit"
end
@@ -55,7 +57,7 @@ class Admin::GroupsController < Admin::ApplicationController
result = Members::CreateService.new(current_user, member_params.merge(limit: -1)).execute(@group)
if result[:status] == :success
- redirect_to [:admin, @group], notice: 'Users were successfully added.'
+ redirect_to [:admin, @group], notice: "Users were successfully added."
else
redirect_to [:admin, @group], alert: result[:message]
end
@@ -65,8 +67,8 @@ class Admin::GroupsController < Admin::ApplicationController
Groups::DestroyService.new(@group, current_user).async_execute
redirect_to admin_groups_path,
- status: 302,
- alert: "Group '#{@group.name}' was scheduled for deletion."
+ status: 302,
+ alert: "Group '#{@group.name}' was scheduled for deletion."
end
private
@@ -89,7 +91,7 @@ class Admin::GroupsController < Admin::ApplicationController
:request_access_enabled,
:visibility_level,
:require_two_factor_authentication,
- :two_factor_grace_period
+ :two_factor_grace_period,
]
end
end
diff --git a/app/controllers/admin/health_check_controller.rb b/app/controllers/admin/health_check_controller.rb
index 7cd80e8b5e1..daf19f2aa63 100644
--- a/app/controllers/admin/health_check_controller.rb
+++ b/app/controllers/admin/health_check_controller.rb
@@ -8,6 +8,6 @@ class Admin::HealthCheckController < Admin::ApplicationController
private
def checks
- ['standard']
+ ["standard"]
end
end
diff --git a/app/controllers/admin/hooks_controller.rb b/app/controllers/admin/hooks_controller.rb
index d0abdec50ae..1100bf8c9f6 100644
--- a/app/controllers/admin/hooks_controller.rb
+++ b/app/controllers/admin/hooks_controller.rb
@@ -14,7 +14,7 @@ class Admin::HooksController < Admin::ApplicationController
@hook = SystemHook.new(hook_params.to_h)
if @hook.save
- redirect_to admin_hooks_path, notice: 'Hook was successfully created.'
+ redirect_to admin_hooks_path, notice: "Hook was successfully created."
else
@hooks = SystemHook.all
render :index
@@ -26,10 +26,10 @@ class Admin::HooksController < Admin::ApplicationController
def update
if hook.update(hook_params)
- flash[:notice] = 'System hook was successfully updated.'
+ flash[:notice] = "System hook was successfully updated."
redirect_to admin_hooks_path
else
- render 'edit'
+ render "edit"
end
end
diff --git a/app/controllers/admin/identities_controller.rb b/app/controllers/admin/identities_controller.rb
index b51c2f678ca..714f7838eca 100644
--- a/app/controllers/admin/identities_controller.rb
+++ b/app/controllers/admin/identities_controller.rb
@@ -13,7 +13,7 @@ class Admin::IdentitiesController < Admin::ApplicationController
@identity.user_id = user.id
if @identity.save
- redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully created.'
+ redirect_to admin_user_identities_path(@user), notice: "User identity was successfully created."
else
render :new
end
@@ -29,7 +29,7 @@ class Admin::IdentitiesController < Admin::ApplicationController
def update
if @identity.update(identity_params)
RepairLdapBlockedUserService.new(@user).execute
- redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully updated.'
+ redirect_to admin_user_identities_path(@user), notice: "User identity was successfully updated."
else
render :edit
end
@@ -38,9 +38,9 @@ class Admin::IdentitiesController < Admin::ApplicationController
def destroy
if @identity.destroy
RepairLdapBlockedUserService.new(@user).execute
- redirect_to admin_user_identities_path(@user), status: 302, notice: 'User identity was successfully removed.'
+ redirect_to admin_user_identities_path(@user), status: 302, notice: "User identity was successfully removed."
else
- redirect_to admin_user_identities_path(@user), status: 302, alert: 'Failed to remove user identity.'
+ redirect_to admin_user_identities_path(@user), status: 302, alert: "Failed to remove user identity."
end
end
diff --git a/app/controllers/admin/impersonation_tokens_controller.rb b/app/controllers/admin/impersonation_tokens_controller.rb
index 706bcc1e549..bbb7e76d918 100644
--- a/app/controllers/admin/impersonation_tokens_controller.rb
+++ b/app/controllers/admin/impersonation_tokens_controller.rb
@@ -40,7 +40,7 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController
# rubocop: enable CodeReuse/ActiveRecord
def finder(options = {})
- PersonalAccessTokensFinder.new({ user: user, impersonation: true }.merge(options))
+ PersonalAccessTokensFinder.new({user: user, impersonation: true}.merge(options))
end
def impersonation_token_params
@@ -52,8 +52,8 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController
@scopes = Gitlab::Auth.available_scopes(current_user)
@impersonation_token ||= finder.build
- @inactive_impersonation_tokens = finder(state: 'inactive').execute
- @active_impersonation_tokens = finder(state: 'active').execute.order(:expires_at)
+ @inactive_impersonation_tokens = finder(state: "inactive").execute
+ @active_impersonation_tokens = finder(state: "active").execute.order(:expires_at)
@new_impersonation_token = PersonalAccessToken.redis_getdel(current_user.id)
end
diff --git a/app/controllers/admin/impersonations_controller.rb b/app/controllers/admin/impersonations_controller.rb
index 65fe22bd8f4..f0e160258f8 100644
--- a/app/controllers/admin/impersonations_controller.rb
+++ b/app/controllers/admin/impersonations_controller.rb
@@ -12,6 +12,6 @@ class Admin::ImpersonationsController < Admin::ApplicationController
private
def authenticate_impersonator!
- render_404 unless impersonator && impersonator.admin? && !impersonator.blocked?
+ render_404 unless impersonator&.admin? && !impersonator.blocked?
end
end
diff --git a/app/controllers/admin/jobs_controller.rb b/app/controllers/admin/jobs_controller.rb
index 0c1afdc3d3b..fc8e9f5b5e3 100644
--- a/app/controllers/admin/jobs_controller.rb
+++ b/app/controllers/admin/jobs_controller.rb
@@ -5,14 +5,14 @@ class Admin::JobsController < Admin::ApplicationController
def index
@scope = params[:scope]
@all_builds = Ci::Build
- @builds = @all_builds.order('id DESC')
+ @builds = @all_builds.order("id DESC")
@builds =
case @scope
- when 'pending'
+ when "pending"
@builds.pending.reverse_order
- when 'running'
+ when "running"
@builds.running.reverse_order
- when 'finished'
+ when "finished"
@builds.finished
else
@builds
diff --git a/app/controllers/admin/keys_controller.rb b/app/controllers/admin/keys_controller.rb
index 4e9262ccc96..5dfcac07988 100644
--- a/app/controllers/admin/keys_controller.rb
+++ b/app/controllers/admin/keys_controller.rb
@@ -17,9 +17,9 @@ class Admin::KeysController < Admin::ApplicationController
respond_to do |format|
if key.destroy
- format.html { redirect_to keys_admin_user_path(user), status: 302, notice: 'User key was successfully removed.' }
+ format.html { redirect_to keys_admin_user_path(user), status: 302, notice: "User key was successfully removed." }
else
- format.html { redirect_to keys_admin_user_path(user), status: 302, alert: 'Failed to remove user key.' }
+ format.html { redirect_to keys_admin_user_path(user), status: 302, alert: "Failed to remove user key." }
end
end
end
diff --git a/app/controllers/admin/labels_controller.rb b/app/controllers/admin/labels_controller.rb
index aa5eae7a474..8a29bff9bbc 100644
--- a/app/controllers/admin/labels_controller.rb
+++ b/app/controllers/admin/labels_controller.rb
@@ -31,7 +31,7 @@ class Admin::LabelsController < Admin::ApplicationController
@label = Labels::UpdateService.new(label_params).execute(@label)
if @label.valid?
- redirect_to admin_labels_path, notice: 'Label was successfully updated.'
+ redirect_to admin_labels_path, notice: "Label was successfully updated."
else
render :edit
end
@@ -43,7 +43,7 @@ class Admin::LabelsController < Admin::ApplicationController
respond_to do |format|
format.html do
- redirect_to admin_labels_path, status: 302, notice: 'Label was removed'
+ redirect_to admin_labels_path, status: 302, notice: "Label was removed"
end
format.js
end
diff --git a/app/controllers/admin/logs_controller.rb b/app/controllers/admin/logs_controller.rb
index 06b0e6a15a3..65cfe926cb5 100644
--- a/app/controllers/admin/logs_controller.rb
+++ b/app/controllers/admin/logs_controller.rb
@@ -15,7 +15,7 @@ class Admin::LogsController < Admin::ApplicationController
Gitlab::EnvironmentLogger,
Gitlab::SidekiqLogger,
Gitlab::RepositoryCheckLogger,
- Gitlab::ProjectServiceLogger
+ Gitlab::ProjectServiceLogger,
]
end
end
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb
index 550f29a58d2..34a7de84802 100644
--- a/app/controllers/admin/projects_controller.rb
+++ b/app/controllers/admin/projects_controller.rb
@@ -7,7 +7,7 @@ class Admin::ProjectsController < Admin::ApplicationController
before_action :group, only: [:show, :transfer]
def index
- params[:sort] ||= 'latest_activity_desc'
+ params[:sort] ||= "latest_activity_desc"
@sort = params[:sort]
@projects = Admin::ProjectsFinder.new(params: params, current_user: current_user).execute
@@ -15,7 +15,7 @@ class Admin::ProjectsController < Admin::ApplicationController
format.html
format.json do
render json: {
- html: view_to_html_string("admin/projects/_projects", locals: { projects: @projects })
+ html: view_to_html_string("admin/projects/_projects", locals: {projects: @projects}),
}
end
end
@@ -25,13 +25,16 @@ class Admin::ProjectsController < Admin::ApplicationController
def show
if @group
@group_members = present_members(
- @group.members.order("access_level DESC").page(params[:group_members_page]))
+ @group.members.order("access_level DESC").page(params[:group_members_page])
+ )
end
@project_members = present_members(
- @project.members.page(params[:project_members_page]))
+ @project.members.page(params[:project_members_page])
+ )
@requesters = present_members(
- AccessRequestsFinder.new(@project).execute(current_user))
+ AccessRequestsFinder.new(@project).execute(current_user)
+ )
end
# rubocop: enable CodeReuse/ActiveRecord
@@ -50,7 +53,7 @@ class Admin::ProjectsController < Admin::ApplicationController
redirect_to(
admin_project_path(@project),
- notice: 'Repository check was triggered.'
+ notice: "Repository check was triggered."
)
end
@@ -58,7 +61,7 @@ class Admin::ProjectsController < Admin::ApplicationController
def project
@project = Project.find_by_full_path(
- [params[:namespace_id], '/', params[:id]].join('')
+ [params[:namespace_id], "/", params[:id]].join("")
)
@project || render_404
end
diff --git a/app/controllers/admin/requests_profiles_controller.rb b/app/controllers/admin/requests_profiles_controller.rb
index 89d4c4f18d9..205447f5b9e 100644
--- a/app/controllers/admin/requests_profiles_controller.rb
+++ b/app/controllers/admin/requests_profiles_controller.rb
@@ -13,7 +13,7 @@ class Admin::RequestsProfilesController < Admin::ApplicationController
if profile
render html: profile.content.html_safe
else
- redirect_to admin_requests_profiles_path, alert: 'Profile not found'
+ redirect_to admin_requests_profiles_path, alert: "Profile not found"
end
end
end
diff --git a/app/controllers/admin/runner_projects_controller.rb b/app/controllers/admin/runner_projects_controller.rb
index 774ce04d079..877ac68f8bc 100644
--- a/app/controllers/admin/runner_projects_controller.rb
+++ b/app/controllers/admin/runner_projects_controller.rb
@@ -9,7 +9,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController
if @runner.assign_to(@project, current_user)
redirect_to admin_runner_path(@runner)
else
- redirect_to admin_runner_path(@runner), alert: 'Failed adding runner to project'
+ redirect_to admin_runner_path(@runner), alert: "Failed adding runner to project"
end
end
@@ -25,7 +25,7 @@ class Admin::RunnerProjectsController < Admin::ApplicationController
def project
@project = Project.find_by_full_path(
- [params[:namespace_id], '/', params[:project_id]].join('')
+ [params[:namespace_id], "/", params[:project_id]].join("")
)
@project || render_404
end
diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb
index 8a00408001e..049f4246abc 100644
--- a/app/controllers/admin/runners_controller.rb
+++ b/app/controllers/admin/runners_controller.rb
@@ -22,7 +22,7 @@ class Admin::RunnersController < Admin::ApplicationController
end
else
assign_builds_and_projects
- render 'show'
+ render "show"
end
end
@@ -34,17 +34,17 @@ class Admin::RunnersController < Admin::ApplicationController
def resume
if Ci::UpdateRunnerService.new(@runner).update(active: true)
- redirect_to admin_runners_path, notice: 'Runner was successfully updated.'
+ redirect_to admin_runners_path, notice: "Runner was successfully updated."
else
- redirect_to admin_runners_path, alert: 'Runner was not updated.'
+ redirect_to admin_runners_path, alert: "Runner was not updated."
end
end
def pause
if Ci::UpdateRunnerService.new(@runner).update(active: false)
- redirect_to admin_runners_path, notice: 'Runner was successfully updated.'
+ redirect_to admin_runners_path, notice: "Runner was successfully updated."
else
- redirect_to admin_runners_path, alert: 'Runner was not updated.'
+ redirect_to admin_runners_path, alert: "Runner was not updated."
end
end
@@ -66,7 +66,7 @@ class Admin::RunnersController < Admin::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def assign_builds_and_projects
- @builds = runner.builds.order('id DESC').first(30)
+ @builds = runner.builds.order("id DESC").first(30)
@projects =
if params[:search].present?
::Project.search(params[:search])
diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb
index c455930c044..c4581eebf44 100644
--- a/app/controllers/admin/services_controller.rb
+++ b/app/controllers/admin/services_controller.rb
@@ -22,7 +22,7 @@ class Admin::ServicesController < Admin::ApplicationController
PropagateServiceTemplateWorker.perform_async(service.id) if service.active?
redirect_to admin_application_settings_services_path,
- notice: 'Application settings saved successfully'
+ notice: "Application settings saved successfully"
else
render :edit
end
@@ -46,6 +46,6 @@ class Admin::ServicesController < Admin::ApplicationController
# rubocop: enable CodeReuse/ActiveRecord
def whitelist_query_limiting
- Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42430')
+ Gitlab::QueryLimiting.whitelist("https://gitlab.com/gitlab-org/gitlab-ce/issues/42430")
end
end
diff --git a/app/controllers/admin/spam_logs_controller.rb b/app/controllers/admin/spam_logs_controller.rb
index 18d22c95b61..60f4ca018d8 100644
--- a/app/controllers/admin/spam_logs_controller.rb
+++ b/app/controllers/admin/spam_logs_controller.rb
@@ -13,8 +13,8 @@ class Admin::SpamLogsController < Admin::ApplicationController
if params[:remove_user]
spam_log.remove_user(deleted_by: current_user)
redirect_to admin_spam_logs_path,
- status: 302,
- notice: "User #{spam_log.user.username} was successfully removed."
+ status: 302,
+ notice: "User #{spam_log.user.username} was successfully removed."
else
spam_log.destroy
head :ok
@@ -25,9 +25,9 @@ class Admin::SpamLogsController < Admin::ApplicationController
spam_log = SpamLog.find(params[:id])
if HamService.new(spam_log).mark_as_ham!
- redirect_to admin_spam_logs_path, notice: 'Spam log successfully submitted as ham.'
+ redirect_to admin_spam_logs_path, notice: "Spam log successfully submitted as ham."
else
- redirect_to admin_spam_logs_path, alert: 'Error with Akismet. Please check the logs for more info.'
+ redirect_to admin_spam_logs_path, alert: "Error with Akismet. Please check the logs for more info."
end
end
end
diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb
index 244fc2b31bb..bc4268fb8db 100644
--- a/app/controllers/admin/system_info_controller.rb
+++ b/app/controllers/admin/system_info_controller.rb
@@ -2,43 +2,51 @@
class Admin::SystemInfoController < Admin::ApplicationController
EXCLUDED_MOUNT_OPTIONS = [
- 'nobrowse',
- 'read-only',
- 'ro'
+ "nobrowse",
+ "read-only",
+ "ro",
].freeze
EXCLUDED_MOUNT_TYPES = [
- 'autofs',
- 'binfmt_misc',
- 'cgroup',
- 'debugfs',
- 'devfs',
- 'devpts',
- 'devtmpfs',
- 'efivarfs',
- 'fuse.gvfsd-fuse',
- 'fuseblk',
- 'fusectl',
- 'hugetlbfs',
- 'mqueue',
- 'proc',
- 'pstore',
- 'rpc_pipefs',
- 'securityfs',
- 'sysfs',
- 'tmpfs',
- 'tracefs',
- 'vfat'
+ "autofs",
+ "binfmt_misc",
+ "cgroup",
+ "debugfs",
+ "devfs",
+ "devpts",
+ "devtmpfs",
+ "efivarfs",
+ "fuse.gvfsd-fuse",
+ "fuseblk",
+ "fusectl",
+ "hugetlbfs",
+ "mqueue",
+ "proc",
+ "pstore",
+ "rpc_pipefs",
+ "securityfs",
+ "sysfs",
+ "tmpfs",
+ "tracefs",
+ "vfat",
].freeze
def show
- @cpus = Vmstat.cpu rescue nil
- @memory = Vmstat.memory rescue nil
+ @cpus = begin
+ Vmstat.cpu
+ rescue
+ nil
+ end
+ @memory = begin
+ Vmstat.memory
+ rescue
+ nil
+ end
mounts = Sys::Filesystem.mounts
@disks = []
mounts.each do |mount|
- mount_options = mount.options.split(',')
+ mount_options = mount.options.split(",")
next if (EXCLUDED_MOUNT_OPTIONS & mount_options).any?
next if (EXCLUDED_MOUNT_TYPES & [mount.mount_type]).any?
@@ -47,9 +55,9 @@ class Admin::SystemInfoController < Admin::ApplicationController
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_used: disk.bytes_used,
+ disk_name: mount.name,
+ mount_path: disk.path,
})
rescue Sys::Filesystem::Error
end
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index bfa7c7d0109..17a2c7924ab 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -96,20 +96,20 @@ class Admin::UsersController < Admin::ApplicationController
update_user { |user| user.disable_two_factor! }
redirect_to admin_user_path(user),
- notice: 'Two-factor Authentication has been disabled for this user'
+ notice: "Two-factor Authentication has been disabled for this user"
end
def create
opts = {
reset_password: true,
- skip_confirmation: true
+ skip_confirmation: true,
}
@user = Users::CreateService.new(current_user, user_params.merge(opts)).execute
respond_to do |format|
if @user.persisted?
- format.html { redirect_to [:admin, @user], notice: 'User was successfully created.' }
+ format.html { redirect_to [:admin, @user], notice: "User was successfully created." }
format.json { render json: @user, status: :created, location: @user }
else
format.html { render "new" }
@@ -124,7 +124,7 @@ class Admin::UsersController < Admin::ApplicationController
if params[:user][:password].present?
password_params = {
password: params[:user][:password],
- password_confirmation: params[:user][:password_confirmation]
+ password_confirmation: params[:user][:password_confirmation],
}
password_params[:password_expires_at] = Time.now unless changing_own_password?
@@ -133,12 +133,12 @@ class Admin::UsersController < Admin::ApplicationController
end
respond_to do |format|
- result = Users::UpdateService.new(current_user, user_params_with_pass.merge(user: user)).execute do |user|
+ result = Users::UpdateService.new(current_user, user_params_with_pass.merge(user: user)).execute { |user|
user.skip_reconfirmation!
- end
+ }
if result[:status] == :success
- format.html { redirect_to [:admin, user], notice: 'User was successfully updated.' }
+ format.html { redirect_to [:admin, user], notice: "User was successfully updated." }
format.json { head :ok }
else
# restore username to keep form action url.
@@ -164,11 +164,11 @@ class Admin::UsersController < Admin::ApplicationController
respond_to do |format|
if success
- format.html { redirect_back_or_admin_user(notice: 'Successfully removed email.') }
+ format.html { redirect_back_or_admin_user(notice: "Successfully removed email.") }
format.json { head :ok }
else
- format.html { redirect_back_or_admin_user(alert: 'There was an error removing the e-mail.') }
- format.json { render json: 'There was an error removing the e-mail.', status: :bad_request }
+ format.html { redirect_back_or_admin_user(alert: "There was an error removing the e-mail.") }
+ format.json { render json: "There was an error removing the e-mail.", status: :bad_request }
end
end
end
@@ -223,7 +223,7 @@ class Admin::UsersController < Admin::ApplicationController
:theme_id,
:twitter,
:username,
- :website_url
+ :website_url,
]
end