diff options
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r-- | app/models/snippet.rb | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index c11c28805eb..d2af26539b6 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -19,6 +19,7 @@ class Snippet < ActiveRecord::Base include Sortable include Linguist::BlobHelper include Gitlab::VisibilityLevel + include Participable default_value_for :visibility_level, Snippet::PRIVATE @@ -47,6 +48,8 @@ class Snippet < ActiveRecord::Base scope :expired, -> { where(["expires_at IS NOT NULL AND expires_at < ?", Time.current]) } scope :non_expired, -> { where(["expires_at IS NULL OR expires_at > ?", Time.current]) } + participant :author, :notes + def self.content_types [ ".rb", ".py", ".pl", ".scala", ".c", ".cpp", ".java", @@ -87,18 +90,6 @@ class Snippet < ActiveRecord::Base visibility_level end - def participants(current_user = self.author) - users = [] - users << author - - notes.each do |note| - users << note.author - users.push *note.mentioned_users(current_user) - end - - users.uniq - end - class << self def search(query) where('(title LIKE :query OR file_name LIKE :query)', query: "%#{query}%") |