diff options
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/abuse_reports_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/applications_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/broadcast_messages_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/dashboard_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/groups_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/identities_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/impersonation_tokens_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/jobs_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/keys_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/projects_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/services_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/admin/spam_logs_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/users_controller.rb | 2 |
14 files changed, 38 insertions, 0 deletions
diff --git a/app/controllers/admin/abuse_reports_controller.rb b/app/controllers/admin/abuse_reports_controller.rb index dc9a6df5f75..68a49f0749f 100644 --- a/app/controllers/admin/abuse_reports_controller.rb +++ b/app/controllers/admin/abuse_reports_controller.rb @@ -1,8 +1,10 @@ class Admin::AbuseReportsController < Admin::ApplicationController + # rubocop: disable CodeReuse/ActiveRecord def index @abuse_reports = AbuseReport.order(id: :desc).page(params[:page]) @abuse_reports.includes(:reporter, :user) end + # rubocop: enable CodeReuse/ActiveRecord def destroy abuse_report = AbuseReport.find(params[:id]) diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb index 5be23c76a95..daa21d1be93 100644 --- a/app/controllers/admin/applications_controller.rb +++ b/app/controllers/admin/applications_controller.rb @@ -4,9 +4,11 @@ class Admin::ApplicationsController < Admin::ApplicationController before_action :set_application, only: [:show, :edit, :update, :destroy] before_action :load_scopes, only: [:new, :create, :edit, :update] + # rubocop: disable CodeReuse/ActiveRecord def index @applications = Doorkeeper::Application.where("owner_id IS NULL") end + # rubocop: enable CodeReuse/ActiveRecord def show end @@ -45,9 +47,11 @@ class Admin::ApplicationsController < Admin::ApplicationController private + # rubocop: disable CodeReuse/ActiveRecord def set_application @application = Doorkeeper::Application.where("owner_id IS NULL").find(params[:id]) end + # rubocop: enable CodeReuse/ActiveRecord # Only allow a trusted parameter "white list" through. def application_params diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb index a9109a1d4d0..b2fbbfc3e64 100644 --- a/app/controllers/admin/broadcast_messages_controller.rb +++ b/app/controllers/admin/broadcast_messages_controller.rb @@ -3,10 +3,12 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController before_action :finder, only: [:edit, :update, :destroy] + # rubocop: disable CodeReuse/ActiveRecord def index @broadcast_messages = BroadcastMessage.order(ends_at: :desc).page(params[:page]) @broadcast_message = BroadcastMessage.new end + # rubocop: enable CodeReuse/ActiveRecord def edit end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 737942f3eb2..5dc3e6c2990 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -4,10 +4,12 @@ class Admin::DashboardController < Admin::ApplicationController COUNTED_ITEMS = [Project, User, Group, ForkedProjectLink, Issue, MergeRequest, Note, Snippet, Key, Milestone].freeze + # rubocop: disable CodeReuse/ActiveRecord def index @counts = Gitlab::Database::Count.approximate_counts(COUNTED_ITEMS) @projects = Project.order_id_desc.without_deleted.with_route.limit(10) @users = User.order_id_desc.limit(10) @groups = Group.order_id_desc.with_route.limit(10) end + # rubocop: enable CodeReuse/ActiveRecord end diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index d7a5b745d3f..2a47f01c6ad 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -10,6 +10,7 @@ class Admin::GroupsController < Admin::ApplicationController @groups = @groups.page(params[:page]) end + # rubocop: disable CodeReuse/ActiveRecord def show @group = Group.with_statistics.joins(:route).group('routes.path').find_by_full_path(params[:id]) @members = present_members( @@ -18,6 +19,7 @@ class Admin::GroupsController < Admin::ApplicationController AccessRequestsFinder.new(@group).execute(current_user)) @projects = @group.projects.with_statistics.page(params[:projects_page]) end + # rubocop: enable CodeReuse/ActiveRecord def new @group = Group.new diff --git a/app/controllers/admin/identities_controller.rb b/app/controllers/admin/identities_controller.rb index ceb45865804..57ad7389a23 100644 --- a/app/controllers/admin/identities_controller.rb +++ b/app/controllers/admin/identities_controller.rb @@ -44,9 +44,11 @@ class Admin::IdentitiesController < Admin::ApplicationController protected + # rubocop: disable CodeReuse/ActiveRecord def user @user ||= User.find_by!(username: params[:user_id]) end + # rubocop: enable CodeReuse/ActiveRecord def identity @identity ||= user.identities.find(params[:id]) diff --git a/app/controllers/admin/impersonation_tokens_controller.rb b/app/controllers/admin/impersonation_tokens_controller.rb index a7b562b1d8e..9ebba88ef16 100644 --- a/app/controllers/admin/impersonation_tokens_controller.rb +++ b/app/controllers/admin/impersonation_tokens_controller.rb @@ -30,9 +30,11 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController private + # rubocop: disable CodeReuse/ActiveRecord def user @user ||= User.find_by!(username: params[:user_id]) end + # rubocop: enable CodeReuse/ActiveRecord def finder(options = {}) PersonalAccessTokensFinder.new({ user: user, impersonation: true }.merge(options)) @@ -42,6 +44,7 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController params.require(:personal_access_token).permit(:name, :expires_at, :impersonation, scopes: []) end + # rubocop: disable CodeReuse/ActiveRecord def set_index_vars @scopes = Gitlab::Auth.available_scopes(current_user) @@ -49,4 +52,5 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController @inactive_impersonation_tokens = finder(state: 'inactive').execute @active_impersonation_tokens = finder(state: 'active').execute.order(:expires_at) end + # rubocop: enable CodeReuse/ActiveRecord end diff --git a/app/controllers/admin/jobs_controller.rb b/app/controllers/admin/jobs_controller.rb index e355d5fdea7..788693c62c4 100644 --- a/app/controllers/admin/jobs_controller.rb +++ b/app/controllers/admin/jobs_controller.rb @@ -1,4 +1,5 @@ class Admin::JobsController < Admin::ApplicationController + # rubocop: disable CodeReuse/ActiveRecord def index @scope = params[:scope] @all_builds = Ci::Build @@ -16,6 +17,7 @@ class Admin::JobsController < Admin::ApplicationController end @builds = @builds.page(params[:page]).per(30) end + # rubocop: enable CodeReuse/ActiveRecord def cancel_all Ci::Build.running_or_pending.each(&:cancel) diff --git a/app/controllers/admin/keys_controller.rb b/app/controllers/admin/keys_controller.rb index 0b76193a90e..0400a3b2f3b 100644 --- a/app/controllers/admin/keys_controller.rb +++ b/app/controllers/admin/keys_controller.rb @@ -24,9 +24,11 @@ class Admin::KeysController < Admin::ApplicationController protected + # rubocop: disable CodeReuse/ActiveRecord def user @user ||= User.find_by!(username: params[:user_id]) end + # rubocop: enable CodeReuse/ActiveRecord def key_params params.require(:user_id, :id) diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 3afe66c3566..5cb08c9787b 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -19,6 +19,7 @@ class Admin::ProjectsController < Admin::ApplicationController end end + # rubocop: disable CodeReuse/ActiveRecord def show if @group @group_members = present_members( @@ -30,7 +31,9 @@ class Admin::ProjectsController < Admin::ApplicationController @requesters = present_members( AccessRequestsFinder.new(@project).execute(current_user)) end + # rubocop: enable CodeReuse/ActiveRecord + # rubocop: disable CodeReuse/ActiveRecord def transfer namespace = Namespace.find_by(id: params[:new_namespace_id]) ::Projects::TransferService.new(@project, current_user, params.dup).execute(namespace) @@ -38,6 +41,7 @@ class Admin::ProjectsController < Admin::ApplicationController @project.reload redirect_to admin_project_path(@project) end + # rubocop: enable CodeReuse/ActiveRecord def repository_check RepositoryCheck::SingleRepositoryWorker.perform_async(@project.id) diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 6c76c55a9d4..090149fc1e2 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -1,6 +1,7 @@ class Admin::RunnersController < Admin::ApplicationController before_action :runner, except: :index + # rubocop: disable CodeReuse/ActiveRecord def index sort = params[:sort] == 'contacted_asc' ? { contacted_at: :asc } : { id: :desc } @runners = Ci::Runner.order(sort) @@ -8,6 +9,7 @@ class Admin::RunnersController < Admin::ApplicationController @runners = @runners.page(params[:page]).per(30) @active_runners_cnt = Ci::Runner.online.count end + # rubocop: enable CodeReuse/ActiveRecord def show assign_builds_and_projects @@ -57,6 +59,7 @@ class Admin::RunnersController < Admin::ApplicationController params.require(:runner).permit(Ci::Runner::FORM_EDITABLE) end + # rubocop: disable CodeReuse/ActiveRecord def assign_builds_and_projects @builds = runner.builds.order('id DESC').first(30) @projects = @@ -69,4 +72,5 @@ class Admin::RunnersController < Admin::ApplicationController @projects = @projects.where.not(id: runner.projects.select(:id)) if runner.projects.any? @projects = @projects.page(params[:page]).per(30) end + # rubocop: enable CodeReuse/ActiveRecord end diff --git a/app/controllers/admin/services_controller.rb b/app/controllers/admin/services_controller.rb index 91a36af34f3..c455930c044 100644 --- a/app/controllers/admin/services_controller.rb +++ b/app/controllers/admin/services_controller.rb @@ -30,16 +30,20 @@ class Admin::ServicesController < Admin::ApplicationController private + # rubocop: disable CodeReuse/ActiveRecord def services_templates Service.available_services_names.map do |service_name| service_template = "#{service_name}_service".camelize.constantize service_template.where(template: true).first_or_create end end + # rubocop: enable CodeReuse/ActiveRecord + # rubocop: disable CodeReuse/ActiveRecord def service @service ||= Service.where(id: params[:id], template: true).first end + # rubocop: enable CodeReuse/ActiveRecord def whitelist_query_limiting Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42430') diff --git a/app/controllers/admin/spam_logs_controller.rb b/app/controllers/admin/spam_logs_controller.rb index d52d67a67a5..8df35d25303 100644 --- a/app/controllers/admin/spam_logs_controller.rb +++ b/app/controllers/admin/spam_logs_controller.rb @@ -1,7 +1,9 @@ class Admin::SpamLogsController < Admin::ApplicationController + # rubocop: disable CodeReuse/ActiveRecord def index @spam_logs = SpamLog.order(id: :desc).page(params[:page]) end + # rubocop: enable CodeReuse/ActiveRecord def destroy spam_log = SpamLog.find(params[:id]) diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index a51a8c3ed4a..85bdc85c55b 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -174,9 +174,11 @@ class Admin::UsersController < Admin::ApplicationController user == current_user end + # rubocop: disable CodeReuse/ActiveRecord def user @user ||= User.find_by!(username: params[:id]) end + # rubocop: enable CodeReuse/ActiveRecord def redirect_back_or_admin_user(options = {}) redirect_back_or_default(default: default_route, options: options) |