diff options
Diffstat (limited to 'app/models/snippet.rb')
-rw-r--r-- | app/models/snippet.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index d4f8c1b3b0b..78b0c0849e3 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -79,6 +79,10 @@ class Snippet < ApplicationRecord scope :with_statistics, -> { joins(:statistics) } scope :inc_projects_namespace_route, -> { includes(project: [:route, :namespace]) } + scope :without_created_by_banned_user, -> do + where_not_exists(Users::BannedUser.where('snippets.author_id = banned_users.user_id')) + end + attr_mentionable :description participant :author @@ -365,6 +369,10 @@ class Snippet < ApplicationRecord def multiple_files? list_files.size > 1 end + + def hidden_due_to_author_ban? + Feature.enabled?(:hide_snippets_of_banned_users) && author.banned? + end end Snippet.prepend_mod_with('Snippet') |