summaryrefslogtreecommitdiff
path: root/app/models/snippet.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-15 17:06:21 +0200
committerDouwe Maan <douwe@gitlab.com>2015-04-15 17:57:31 +0200
commit7633d60268782704375fa2cf9a0fbb9a2ad2ec06 (patch)
treefe8f31a95da3fe0ecede83a75a77adb3ce2242a0 /app/models/snippet.rb
parent959ebbcade63423048320daaa814634c41842a36 (diff)
downloadgitlab-ce-7633d60268782704375fa2cf9a0fbb9a2ad2ec06.tar.gz
Include snippet author in recipients of snippet note notification.
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r--app/models/snippet.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb
index b35e72c4bdb..c53d2a8d603 100644
--- a/app/models/snippet.rb
+++ b/app/models/snippet.rb
@@ -87,6 +87,18 @@ class Snippet < ActiveRecord::Base
visibility_level
end
+ def participants(current_user = self.author)
+ users = []
+ users << author
+
+ notes.each do |note|
+ users << note.author
+ mentions << note.mentioned_users(current_user)
+ end
+
+ users.concat(mentions.reduce([], :|)).uniq
+ end
+
class << self
def search(query)
where('(title LIKE :query OR file_name LIKE :query)', query: "%#{query}%")