diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-10-28 18:01:59 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-10-31 15:14:56 +0300 |
commit | 9addb14773fb7fb8b31cf2e61c8a54ee347c979a (patch) | |
tree | ba8398a25bd76c6e556a77b56d4d8ba755cb83b2 /app/models/project.rb | |
parent | 76753758d0102d2a2acd9f4c6e1922eb45296ddc (diff) |
Merge branch 'adam-fix-labels-find-or-create' into 'master'
Pass user instance to Labels::FindOrCreateService or skip_authorization: true
It fixes a bug described in #23694 when `project.owner` was passed to `Labels::FindOrCreateService`. `Labels::FindOrCreateService` expected a user instance and `project.owner` may return a group as well. This MR makes sure that we either pass a user instance or `skip_authorization: true`.
Fixes #23694
See merge request !7093
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 6685baab699..a5c1d5c9e31 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -738,7 +738,7 @@ class Project < ActiveRecord::Base def create_labels Label.templates.each do |label| params = label.attributes.except('id', 'template', 'created_at', 'updated_at') - Labels::FindOrCreateService.new(owner, self, params).execute + Labels::FindOrCreateService.new(nil, self, params).execute(skip_authorization: true) end end |