search: add status:modqueue, status:unmoderated metatags.

* status:modqueue = ~status:pending ~status:flagged
* status:unmoderated = status:modqueue -user:self -approver:self -disapproval:any
This commit is contained in:
evazion
2018-08-23 14:45:33 -05:00
parent 89c4fe150a
commit 4f02c7f70a
4 changed files with 23 additions and 2 deletions

View File

@@ -2130,6 +2130,7 @@ class PostTest < ActiveSupport::TestCase
banned = FactoryBot.create(:post, is_banned: true)
all = [banned, deleted, flagged, pending]
assert_tag_match([flagged, pending], "status:modqueue")
assert_tag_match([pending], "status:pending")
assert_tag_match([flagged], "status:flagged")
assert_tag_match([deleted], "status:deleted")
@@ -2138,6 +2139,7 @@ class PostTest < ActiveSupport::TestCase
assert_tag_match(all, "status:any")
assert_tag_match(all, "status:all")
assert_tag_match(all - [flagged, pending], "-status:modqueue")
assert_tag_match(all - [pending], "-status:pending")
assert_tag_match(all - [flagged], "-status:flagged")
assert_tag_match(all - [deleted], "-status:deleted")
@@ -2145,6 +2147,17 @@ class PostTest < ActiveSupport::TestCase
assert_tag_match(all, "-status:active")
end
should "return posts for the status:unmoderated metatag" do
flagged = FactoryBot.create(:post, is_flagged: true)
pending = FactoryBot.create(:post, is_pending: true)
disapproved = FactoryBot.create(:post, is_pending: true)
FactoryBot.create(:post_flag, post: flagged)
FactoryBot.create(:post_disapproval, post: disapproved, reason: "disinterest")
assert_tag_match([pending, flagged], "status:unmoderated")
end
should "respect the 'Deleted post filter' option when using the status:banned metatag" do
deleted = FactoryBot.create(:post, is_deleted: true, is_banned: true)
undeleted = FactoryBot.create(:post, is_banned: true)