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/models/note.rb | |
parent | 5e11c9b77cb1b2b77ee29359047b55807afe255d (diff) | |
download | gitlab-ce-27d91a629918e417a9e87825e838209b9ace79c1.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/note.rb')
-rw-r--r-- | app/models/note.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index f5f6ecf6336..cfa7ba98081 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -499,8 +499,18 @@ class Note < ApplicationRecord project end + def user_mentions + noteable.user_mentions.where(note: self) + end + private + # Using this method followed by a call to `save` may result in ActiveRecord::RecordNotUnique exception + # in a multithreaded environment. Make sure to use it within a `safe_ensure_unique` block. + def model_user_mention + user_mentions.first_or_initialize + end + def system_note_viewable_by?(user) return true unless system_note_metadata |