summaryrefslogtreecommitdiff
path: root/app/services/labels
diff options
context:
space:
mode:
authorAdam Niedzielski <adamsunday@gmail.com>2016-10-28 11:31:45 +0200
committerAdam Niedzielski <adamsunday@gmail.com>2016-10-28 11:31:45 +0200
commite2c603696a9647c15cd154156f13d0e203a930f1 (patch)
tree22f64b82526f74fabb9009db8f6932c4e8d74d12 /app/services/labels
parent20a7db4483904c7280093a0309a63dfd1b7ef72e (diff)
downloadgitlab-ce-e2c603696a9647c15cd154156f13d0e203a930f1.tar.gz
Pass user instance to Labels::FindOrCreateService or skip_authorization: trueadam-fix-labels-find-or-create
Do not pass project.owner because it may return a group and Labels::FindOrCreateService throws an error in this case. Fixes #23694.
Diffstat (limited to 'app/services/labels')
-rw-r--r--app/services/labels/find_or_create_service.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/services/labels/find_or_create_service.rb b/app/services/labels/find_or_create_service.rb
index 74291312c4e..d622f9edd33 100644
--- a/app/services/labels/find_or_create_service.rb
+++ b/app/services/labels/find_or_create_service.rb
@@ -2,21 +2,24 @@ module Labels
class FindOrCreateService
def initialize(current_user, project, params = {})
@current_user = current_user
- @group = project.group
@project = project
@params = params.dup
end
- def execute
+ def execute(skip_authorization: false)
+ @skip_authorization = skip_authorization
find_or_create_label
end
private
- attr_reader :current_user, :group, :project, :params
+ attr_reader :current_user, :project, :params, :skip_authorization
def available_labels
- @available_labels ||= LabelsFinder.new(current_user, project_id: project.id).execute
+ @available_labels ||= LabelsFinder.new(
+ current_user,
+ project_id: project.id
+ ).execute(skip_authorization: skip_authorization)
end
def find_or_create_label