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:
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index b9b884b88c5..13fff9520b7 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -173,6 +173,14 @@ class Note < ApplicationRecord
end
scope :with_metadata, -> { includes(:system_note_metadata) }
+ scope :without_hidden, -> {
+ if Feature.enabled?(:hidden_notes)
+ where_not_exists(Users::BannedUser.where('notes.author_id = banned_users.user_id'))
+ else
+ all
+ end
+ }
+
scope :for_note_or_capitalized_note, ->(text) { where(note: [text, text.capitalize]) }
scope :like_note_or_capitalized_note, ->(text) { where('(note LIKE ? OR note LIKE ?)', text, text.capitalize) }