diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-08-31 12:38:32 +0200 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-09-14 14:50:32 +0200 |
commit | 073ba05d315881730de3995042cc4256c116e2c4 (patch) | |
tree | 7c8d4f56a8fe9a991b0a03f221ff7fad5332ccd5 /lib/api/notes.rb | |
parent | b9287208523e1a5c05939fe0db038df51a9082fc (diff) | |
download | gitlab-ce-073ba05d315881730de3995042cc4256c116e2c4.tar.gz |
Support discussion lock in the API
Diffstat (limited to 'lib/api/notes.rb')
-rw-r--r-- | lib/api/notes.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb index d6e7203adaf..b3db366d875 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -71,6 +71,8 @@ module API post ":id/#{noteables_str}/:noteable_id/notes" do noteable = find_project_noteable(noteables_str, params[:noteable_id]) + authorize! :create_note, user_project + opts = { note: params[:body], noteable_type: noteables_str.classify, @@ -82,6 +84,11 @@ module API opts[:created_at] = params[:created_at] end + noteable_type = opts[:noteable_type].to_s + noteable = Issue.find(opts[:noteable_id]) if noteable_type == 'Issue' + noteable = MergeRequest.find(opts[:noteable_id]) if noteable_type == 'MergeRequest' + authorize! :create_note, noteable if noteable + note = ::Notes::CreateService.new(user_project, current_user, opts).execute if note.valid? |