diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-10 15:07:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-10 15:07:52 +0000 |
commit | 27d91a629918e417a9e87825e838209b9ace79c1 (patch) | |
tree | e066c3fc84e3011641e662252810cb2c240edb90 /app/services/notes | |
parent | 5e11c9b77cb1b2b77ee29359047b55807afe255d (diff) | |
download | gitlab-ce-27d91a629918e417a9e87825e838209b9ace79c1.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/notes')
-rw-r--r-- | app/services/notes/create_service.rb | 6 | ||||
-rw-r--r-- | app/services/notes/update_service.rb | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb index 9e6cbfa06fe..3468341a0f2 100644 --- a/app/services/notes/create_service.rb +++ b/app/services/notes/create_service.rb @@ -33,7 +33,11 @@ module Notes NewNoteWorker.perform_async(note.id) end - if !only_commands && note.save + note_saved = note.with_transaction_returning_status do + !only_commands && note.save && note.store_mentions! + end + + if note_saved if note.part_of_discussion? && note.discussion.can_convert_to_discussion? note.discussion.convert_to_discussion!(save: true) end diff --git a/app/services/notes/update_service.rb b/app/services/notes/update_service.rb index 573be8fbe8b..15c556498ec 100644 --- a/app/services/notes/update_service.rb +++ b/app/services/notes/update_service.rb @@ -7,7 +7,11 @@ module Notes old_mentioned_users = note.mentioned_users(current_user).to_a - note.update(params.merge(updated_by: current_user)) + note.assign_attributes(params.merge(updated_by: current_user)) + + note.with_transaction_returning_status do + note.save && note.store_mentions! + end only_commands = false |