mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Remove experimental support for query string on /filter route (#20632)
This commit is contained in:
committed by
GitHub
parent
520d4f504b
commit
b06e31f8e7
@@ -9,41 +9,37 @@ RSpec.describe TopicsFilter do
|
||||
|
||||
describe "#filter" do
|
||||
it "should return all topics when input is blank" do
|
||||
expect(TopicsFilter.new(guardian: Guardian.new).filter("").pluck(:id)).to contain_exactly(
|
||||
expect(TopicsFilter.new(guardian: Guardian.new).filter.pluck(:id)).to contain_exactly(
|
||||
topic.id,
|
||||
closed_topic.id,
|
||||
archived_topic.id,
|
||||
)
|
||||
end
|
||||
|
||||
it "should return all topics when input does not match any filters" do
|
||||
expect(
|
||||
TopicsFilter.new(guardian: Guardian.new).filter("randomstring").pluck(:id),
|
||||
).to contain_exactly(topic.id, closed_topic.id, archived_topic.id)
|
||||
end
|
||||
context "when filtering by topic's status" do
|
||||
it "should only return topics that have not been closed or archived when input is `status:open`" do
|
||||
expect(
|
||||
TopicsFilter.new(guardian: Guardian.new).filter(status: "open").pluck(:id),
|
||||
).to contain_exactly(topic.id)
|
||||
end
|
||||
|
||||
it "should only return topics that have not been closed or archived when input is `status:open`" do
|
||||
expect(
|
||||
TopicsFilter.new(guardian: Guardian.new).filter("status:open").pluck(:id),
|
||||
).to contain_exactly(topic.id)
|
||||
end
|
||||
it "should only return topics that have been deleted when input is `status:deleted` and user can see deleted topics" do
|
||||
expect(
|
||||
TopicsFilter.new(guardian: Guardian.new(admin)).filter(status: "deleted").pluck(:id),
|
||||
).to contain_exactly(deleted_topic_id)
|
||||
end
|
||||
|
||||
it "should only return topics that have been deleted when input is `status:deleted` and user can see deleted topics" do
|
||||
expect(
|
||||
TopicsFilter.new(guardian: Guardian.new(admin)).filter("status:deleted").pluck(:id),
|
||||
).to contain_exactly(deleted_topic_id)
|
||||
end
|
||||
it "should status filter when input is `status:deleted` and user cannot see deleted topics" do
|
||||
expect(
|
||||
TopicsFilter.new(guardian: Guardian.new).filter(status: "deleted").pluck(:id),
|
||||
).to contain_exactly(topic.id, closed_topic.id, archived_topic.id)
|
||||
end
|
||||
|
||||
it "should status filter when input is `status:deleted` and user cannot see deleted topics" do
|
||||
expect(
|
||||
TopicsFilter.new(guardian: Guardian.new).filter("status:deleted").pluck(:id),
|
||||
).to contain_exactly(topic.id, closed_topic.id, archived_topic.id)
|
||||
end
|
||||
|
||||
it "should only return topics that have been archived when input is `status:archived`" do
|
||||
expect(
|
||||
TopicsFilter.new(guardian: Guardian.new).filter("status:archived").pluck(:id),
|
||||
).to contain_exactly(archived_topic.id)
|
||||
it "should only return topics that have been archived when input is `status:archived`" do
|
||||
expect(
|
||||
TopicsFilter.new(guardian: Guardian.new).filter(status: "archived").pluck(:id),
|
||||
).to contain_exactly(archived_topic.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user