Commit 78681194 authored by Jarka Košanová's avatar Jarka Košanová Committed by Lin Jen-Shin

Rename methods to make more sense

parent 330389ab
...@@ -669,26 +669,24 @@ module QuickActions ...@@ -669,26 +669,24 @@ module QuickActions
end end
def parent def parent
project || issuable_group project || group
end end
def issuable_group def group
strong_memoize(:issuable_group) do strong_memoize(:group) do
issuable.group if issuable.respond_to?(:group) issuable.group if issuable.respond_to?(:group)
end end
end end
def find_labels(label_references = nil) def find_labels(labels_params = nil)
labels_params = { include_ancestor_groups: true } finder_params = { include_ancestor_groups: true }
labels_params[:project_id] = project.id if project finder_params[:project_id] = project.id if project
labels_params[:group_id] = issuable_group.id if issuable_group finder_params[:group_id] = group.id if group
labels_params[:name] = label_references.split if label_references finder_params[:name] = labels_params.split if labels_params
result = LabelsFinder.new(current_user, labels_params).execute result = LabelsFinder.new(current_user, finder_params).execute
return result unless label_references extract_references(labels_params, :label) | result
extract_references(label_references, :label) | result
end end
def find_label_references(labels_param) def find_label_references(labels_param)
...@@ -719,9 +717,11 @@ module QuickActions ...@@ -719,9 +717,11 @@ module QuickActions
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def extract_references(arg, type) def extract_references(arg, type)
return [] unless arg
ext = Gitlab::ReferenceExtractor.new(project, current_user) ext = Gitlab::ReferenceExtractor.new(project, current_user)
ext.analyze(arg, author: current_user, group: issuable_group) ext.analyze(arg, author: current_user, group: group)
ext.references(type) ext.references(type)
end end
......
...@@ -198,7 +198,7 @@ describe Notes::QuickActionsService do ...@@ -198,7 +198,7 @@ describe Notes::QuickActionsService do
end end
end end
describe '/label' do describe '/unlabel' do
let(:project) { nil } let(:project) { nil }
let!(:bug) { create(:group_label, title: 'bug', group: group)} let!(:bug) { create(:group_label, title: 'bug', group: group)}
let!(:feature) { create(:group_label, title: 'feature', group: group)} let!(:feature) { create(:group_label, title: 'feature', group: group)}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment