mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
FIX: Do not suggest similar topics from secure categories you can't see.
This commit is contained in:
@ -162,10 +162,19 @@ describe TopicsController do
|
||||
end
|
||||
|
||||
it "delegates to Topic.similar_to" do
|
||||
Topic.expects(:similar_to).with(title, raw).returns([Fabricate(:topic)])
|
||||
Topic.expects(:similar_to).with(title, raw, nil).returns([Fabricate(:topic)])
|
||||
xhr :get, :similar_to, title: title, raw: raw
|
||||
end
|
||||
|
||||
context "logged in" do
|
||||
let(:user) { log_in }
|
||||
|
||||
it "passes a user throught if logged in" do
|
||||
Topic.expects(:similar_to).with(title, raw, user).returns([Fabricate(:topic)])
|
||||
xhr :get, :similar_to, title: title, raw: raw
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user