diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-11-06 22:40:19 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-11-06 22:40:19 +0800 |
commit | f8b681f6e985d49b39d399d60666b051a60a6502 (patch) | |
tree | f18b6f54030cb3f21fafbc50ebd390281e22d413 /app/controllers | |
parent | fc6aad0b4442c58fde1ac924cb2dd73823273537 (diff) | |
download | gitlab-ce-f8b681f6e985d49b39d399d60666b051a60a6502.tar.gz |
WIP
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/concerns/boards_responses.rb | 6 | ||||
-rw-r--r-- | app/controllers/concerns/creates_commit.rb | 9 | ||||
-rw-r--r-- | app/controllers/concerns/issuable_actions.rb | 6 | ||||
-rw-r--r-- | app/controllers/concerns/issuable_collections.rb | 2 | ||||
-rw-r--r-- | app/controllers/concerns/issues_action.rb | 1 | ||||
-rw-r--r-- | app/controllers/concerns/merge_requests_action.rb | 1 | ||||
-rw-r--r-- | app/controllers/concerns/milestone_actions.rb | 10 |
7 files changed, 19 insertions, 16 deletions
diff --git a/app/controllers/concerns/boards_responses.rb b/app/controllers/concerns/boards_responses.rb index 058e4591770..2246ad7a4e6 100644 --- a/app/controllers/concerns/boards_responses.rb +++ b/app/controllers/concerns/boards_responses.rb @@ -23,14 +23,12 @@ module BoardsResponses return render_403 unless can?(current_user, ability, resource) end - # rubocop:disable Cop/ModuleWithInstanceVariables def respond_with_boards - respond_with(@boards) + respond_with(@boards) # rubocop:disable Cop/ModuleWithInstanceVariables end - # rubocop:disable Cop/ModuleWithInstanceVariables def respond_with_board - respond_with(@board) + respond_with(@board) # rubocop:disable Cop/ModuleWithInstanceVariables end def respond_with(resource) diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb index 0350c9228c9..27f77af71d1 100644 --- a/app/controllers/concerns/creates_commit.rb +++ b/app/controllers/concerns/creates_commit.rb @@ -46,6 +46,7 @@ module CreatesCommit end end end + # rubocop:enable Cop/ModuleWithInstanceVariables def authorize_edit_tree! return if can_collaborate_with_project? @@ -90,6 +91,7 @@ module CreatesCommit } ) end + # rubocop:enable Cop/ModuleWithInstanceVariables def existing_merge_request_path project_merge_request_path(@project, @merge_request) @@ -102,18 +104,17 @@ module CreatesCommit @merge_request = MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened .find_by(source_project_id: @project_to_commit_into, source_branch: @branch_name, target_branch: @start_branch) end + # rubocop:enable Cop/ModuleWithInstanceVariables - # rubocop:disable Cop/ModuleWithInstanceVariables def different_project? - @project_to_commit_into != @project + @project_to_commit_into != @project # rubocop:disable Cop/ModuleWithInstanceVariables end - # rubocop:disable Cop/ModuleWithInstanceVariables def create_merge_request? # Even if the field is set, if we're checking the same branch # as the target branch in the same project, # we don't want to create a merge request. params[:create_merge_request].present? && - (different_project? || @start_branch != @branch_name) + (different_project? || @start_branch != @branch_name) # rubocop:disable Cop/ModuleWithInstanceVariables end end diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb index 01645d4f6c1..1916020bdd9 100644 --- a/app/controllers/concerns/issuable_actions.rb +++ b/app/controllers/concerns/issuable_actions.rb @@ -99,9 +99,8 @@ module IssuableActions end end - # rubocop:disable Cop/ModuleWithInstanceVariables def labels - @labels ||= LabelsFinder.new(current_user, project_id: @project.id).execute + @labels ||= LabelsFinder.new(current_user, project_id: @project.id).execute # rubocop:disable Cop/ModuleWithInstanceVariables end def authorize_destroy_issuable! @@ -110,9 +109,8 @@ module IssuableActions end end - # rubocop:disable Cop/ModuleWithInstanceVariables def authorize_admin_issuable! - unless can?(current_user, :"admin_#{resource_name}", @project) + unless can?(current_user, :"admin_#{resource_name}", @project) # rubocop:disable Cop/ModuleWithInstanceVariables return access_denied! end end diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index cfd1d077fe8..521d6e8eca5 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -26,6 +26,7 @@ module IssuableCollections @users = [] end + # rubocop:enable Cop/ModuleWithInstanceVariables def issues_collection issues_finder.execute.preload(:project, :author, :assignees, :labels, :milestone, project: :namespace) @@ -110,6 +111,7 @@ module IssuableCollections @filter_params.permit(IssuableFinder::VALID_PARAMS) end + # rubocop:enable Cop/ModuleWithInstanceVariables def set_default_state params[:state] = 'opened' if params[:state].blank? diff --git a/app/controllers/concerns/issues_action.rb b/app/controllers/concerns/issues_action.rb index a28dd376c80..b6803b14fe1 100644 --- a/app/controllers/concerns/issues_action.rb +++ b/app/controllers/concerns/issues_action.rb @@ -18,4 +18,5 @@ module IssuesAction format.atom { render layout: 'xml.atom' } end end + # rubocop:enable Cop/ModuleWithInstanceVariables end diff --git a/app/controllers/concerns/merge_requests_action.rb b/app/controllers/concerns/merge_requests_action.rb index 0f61e1ccc06..20190fa256b 100644 --- a/app/controllers/concerns/merge_requests_action.rb +++ b/app/controllers/concerns/merge_requests_action.rb @@ -12,6 +12,7 @@ module MergeRequestsAction @collection_type = "MergeRequest" @issuable_meta_data = issuable_meta_data(@merge_requests, @collection_type) end + # rubocop:enable Cop/ModuleWithInstanceVariables private diff --git a/app/controllers/concerns/milestone_actions.rb b/app/controllers/concerns/milestone_actions.rb index 46facd915c8..4996c6b90f3 100644 --- a/app/controllers/concerns/milestone_actions.rb +++ b/app/controllers/concerns/milestone_actions.rb @@ -1,4 +1,3 @@ -# rubocop:disable Cop/ModuleWithInstanceVariables module MilestoneActions extend ActiveSupport::Concern @@ -7,7 +6,7 @@ module MilestoneActions format.html { redirect_to milestone_redirect_path } format.json do render json: tabs_json("shared/milestones/_merge_requests_tab", { - merge_requests: @milestone.sorted_merge_requests, + merge_requests: @milestone.sorted_merge_requests, # rubocop:disable Cop/ModuleWithInstanceVariables show_project_name: true }) end @@ -19,7 +18,7 @@ module MilestoneActions format.html { redirect_to milestone_redirect_path } format.json do render json: tabs_json("shared/milestones/_participants_tab", { - users: @milestone.participants + users: @milestone.participants # rubocop:disable Cop/ModuleWithInstanceVariables }) end end @@ -30,7 +29,8 @@ module MilestoneActions format.html { redirect_to milestone_redirect_path } format.json do render json: tabs_json("shared/milestones/_labels_tab", { - labels: @milestone.labels + labels: @milestone.labels # rubocop:disable Cop/ModuleWithInstanceVariables + }) end end @@ -44,6 +44,7 @@ module MilestoneActions } end + # rubocop:disable Cop/ModuleWithInstanceVariables def milestone_redirect_path if @project project_milestone_path(@project, @milestone) @@ -53,4 +54,5 @@ module MilestoneActions dashboard_milestone_path(@milestone.safe_title, title: @milestone.title) end end + # rubocop:enable Cop/ModuleWithInstanceVariables end |