Skip to content
Snippets Groups Projects
Commit f8b681f6 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files

WIP

parent fc6aad0b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -46,6 +46,7 @@ module CreatesCommit
end
end
end
# rubocop:enable Cop/ModuleWithInstanceVariables
 
def authorize_edit_tree!
return if can_collaborate_with_project?
Loading
Loading
@@ -90,6 +91,7 @@ module CreatesCommit
}
)
end
# rubocop:enable Cop/ModuleWithInstanceVariables
 
def existing_merge_request_path
project_merge_request_path(@project, @merge_request)
Loading
Loading
@@ -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
Loading
Loading
@@ -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!
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
@@ -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?
Loading
Loading
Loading
Loading
@@ -18,4 +18,5 @@ module IssuesAction
format.atom { render layout: 'xml.atom' }
end
end
# rubocop:enable Cop/ModuleWithInstanceVariables
end
Loading
Loading
@@ -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
 
Loading
Loading
# rubocop:disable Cop/ModuleWithInstanceVariables
module MilestoneActions
extend ActiveSupport::Concern
 
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
@@ -44,6 +44,7 @@ module MilestoneActions
}
end
 
# rubocop:disable Cop/ModuleWithInstanceVariables
def milestone_redirect_path
if @project
project_milestone_path(@project, @milestone)
Loading
Loading
@@ -53,4 +54,5 @@ module MilestoneActions
dashboard_milestone_path(@milestone.safe_title, title: @milestone.title)
end
end
# rubocop:enable Cop/ModuleWithInstanceVariables
end
Loading
Loading
@@ -30,36 +30,28 @@ module ResolvableDiscussion
allow_nil: true
end
 
# rubocop:disable Cop/ModuleWithInstanceVariables
def resolvable?
return @resolvable if @resolvable.present?
@resolvable = potentially_resolvable? && notes.any?(&:resolvable?)
@resolvable ||= potentially_resolvable? && notes.any?(&:resolvable?)
end
 
# rubocop:disable Cop/ModuleWithInstanceVariables
def resolved?
return @resolved if @resolved.present?
@resolved = resolvable? && notes.none?(&:to_be_resolved?)
@resolved ||= resolvable? && notes.none?(&:to_be_resolved?)
end
 
def first_note
@first_note ||= notes.first
end
 
# rubocop:disable Cop/ModuleWithInstanceVariables
def first_note_to_resolve
return unless resolvable?
 
@first_note_to_resolve ||= notes.find(&:to_be_resolved?)
@first_note_to_resolve ||= notes.find(&:to_be_resolved?) # rubocop:disable Cop/ModuleWithInstanceVariables
end
 
# rubocop:disable Cop/ModuleWithInstanceVariables
def last_resolved_note
return unless resolved?
 
@last_resolved_note ||= resolved_notes.sort_by(&:resolved_at).last
@last_resolved_note ||= resolved_notes.sort_by(&:resolved_at).last # rubocop:disable Cop/ModuleWithInstanceVariables
end
 
def resolved_notes
Loading
Loading
@@ -100,7 +92,7 @@ module ResolvableDiscussion
yield(notes_relation)
 
# Set the notes array to the updated notes
@notes = notes_relation.fresh.to_a
@notes = notes_relation.fresh.to_a # rubocop:disable Cop/ModuleWithInstanceVariables
 
self.class.memoized_values.each do |var|
instance_variable_set(:"@#{var}", nil)
Loading
Loading
Loading
Loading
@@ -3,17 +3,21 @@ module Gitlab
module Pipeline
module Chain
module Helpers
# rubocop:disable Cop/ModuleWithInstanceVariables
def branch_exists?
return @is_branch if defined?(@is_branch)
 
@is_branch = project.repository.branch_exists?(pipeline.ref)
end
# rubocop:enable Cop/ModuleWithInstanceVariables
 
# rubocop:disable Cop/ModuleWithInstanceVariables
def tag_exists?
return @is_tag if defined?(@is_tag)
 
@is_tag = project.repository.tag_exists?(pipeline.ref)
end
# rubocop:enable Cop/ModuleWithInstanceVariables
 
def error(message)
pipeline.errors.add(:base, message)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment