diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/snippet.rb | 12 |
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}%") |