mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 16:29:32 +08:00
FIX: handle quote rendering for external Discourse instance (#16722)
Gracefully handle quotes from an external discourse instance by stripping quote-controls and including username in the title
This commit is contained in:
@ -4,6 +4,30 @@ require 'quote_comparer'
|
||||
|
||||
describe QuoteComparer do
|
||||
|
||||
describe "#missing?" do
|
||||
fab!(:post) { Fabricate(:post, raw: "This has **text** we _are_ matching") }
|
||||
|
||||
it "returns true for missing topic and post" do
|
||||
expect(QuoteComparer.new(nil, nil, "test")).to be_missing
|
||||
end
|
||||
|
||||
it "returns true for missing topic" do
|
||||
expect(QuoteComparer.new(nil, post.post_number, "test")).to be_missing
|
||||
end
|
||||
|
||||
it "returns true for missing post" do
|
||||
expect(QuoteComparer.new(post.topic_id, nil, "test")).to be_missing
|
||||
end
|
||||
|
||||
it "returns false for only missing text" do
|
||||
expect(QuoteComparer.new(post.topic_id, post.post_number, nil)).to_not be_missing
|
||||
end
|
||||
|
||||
it "returns false for no missing topic and post" do
|
||||
expect(QuoteComparer.new(post.topic_id, post.post_number, "test")).to_not be_missing
|
||||
end
|
||||
end
|
||||
|
||||
describe "#modified?" do
|
||||
fab!(:post) { Fabricate(:post, raw: "This has **text** we _are_ matching") }
|
||||
|
||||
@ -11,10 +35,6 @@ describe QuoteComparer do
|
||||
QuoteComparer.new(post.topic_id, post.post_number, text)
|
||||
end
|
||||
|
||||
it "returns true for no post" do
|
||||
expect(QuoteComparer.new(nil, nil, "test")).to be_modified
|
||||
end
|
||||
|
||||
it "returns true for nil text" do
|
||||
expect(qc(nil)).to be_modified
|
||||
end
|
||||
|
Reference in New Issue
Block a user