search: clean up status: metatag.

* Fix not being able to use the status: metatag twice in the same search.
* Fix status:active excluding banned posts.
* Fix status:garbage returning all posts.
This commit is contained in:
evazion
2020-04-20 03:22:15 -05:00
parent c452aa6c78
commit c92ac9ab89
4 changed files with 47 additions and 41 deletions

View File

@@ -60,6 +60,8 @@ class Post < ApplicationRecord
scope :pending, -> { where(is_pending: true) }
scope :flagged, -> { where(is_flagged: true) }
scope :banned, -> { where(is_banned: true) }
scope :active, -> { where(is_pending: false, is_deleted: false, is_flagged: false) }
scope :pending_or_flagged, -> { pending.or(flagged) }
scope :unflagged, -> { where(is_flagged: false) }