mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 02:48:28 +08:00
FEATURE: Include advanced search option to include unlisted topics in the results (#27958)
--------- Co-authored-by: Régis Hanol <regis@hanol.fr>
This commit is contained in:
@ -2541,6 +2541,23 @@ RSpec.describe Search do
|
||||
end
|
||||
end
|
||||
|
||||
describe "include:invisible / include:unlisted" do
|
||||
it "allows including invisible topics in the results" do
|
||||
topic = Fabricate(:topic, title: "I am testing a search", visible: false)
|
||||
post = Fabricate(:post, topic: topic, raw: "this is the first post", post_number: 1)
|
||||
_post2 = Fabricate(:post, topic: topic, raw: "this is the second post", post_number: 2)
|
||||
|
||||
results = Search.execute("testing include:invisible")
|
||||
expect(results.posts.map(&:id)).to eq([post.id])
|
||||
|
||||
results = Search.execute("testing include:unlisted")
|
||||
expect(results.posts.map(&:id)).to eq([post.id])
|
||||
|
||||
results = Search.execute("testing")
|
||||
expect(results.posts).to eq([])
|
||||
end
|
||||
end
|
||||
|
||||
describe "ignore_diacritics" do
|
||||
before { SiteSetting.search_ignore_accents = true }
|
||||
let!(:post1) { Fabricate(:post, raw: "สวัสดี Rágis hello") }
|
||||
|
Reference in New Issue
Block a user