Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-10 18:07:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-10 18:07:52 +0300
commit27d91a629918e417a9e87825e838209b9ace79c1 (patch)
treee066c3fc84e3011641e662252810cb2c240edb90 /app/models/note.rb
parent5e11c9b77cb1b2b77ee29359047b55807afe255d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb10
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