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:
Sérgio Saquetim
2024-07-18 13:43:53 -03:00
committed by GitHub
parent e1f638b0a3
commit 6a3e12a39c
2 changed files with 21 additions and 1 deletions

View File

@ -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") }