mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Remove full quotes of direct replies. (#6729)
This commit is contained in:
committed by
Régis Hanol
parent
df3bb07ec6
commit
41e184280d
@@ -1144,4 +1144,32 @@ describe CookedPostProcessor do
|
||||
|
||||
end
|
||||
|
||||
context "remove direct reply full quote" do
|
||||
let(:topic) { Fabricate(:topic) }
|
||||
|
||||
it 'works' do
|
||||
post = Fabricate(:post, topic: topic, raw: "this is the first post")
|
||||
hidden = Fabricate(:post, topic: topic, hidden: true, raw: "this is the second post")
|
||||
small_action = Fabricate(:post, topic: topic, post_type: Post.types[:small_action])
|
||||
raw = <<~RAW
|
||||
[quote="#{post.user.username}, post:#{post.post_number}, topic:#{topic.id}"]
|
||||
this is the first post
|
||||
[/quote]
|
||||
|
||||
and this is the third reply
|
||||
RAW
|
||||
reply = Fabricate(:post, topic: topic, raw: raw)
|
||||
|
||||
cpp = CookedPostProcessor.new(reply)
|
||||
cpp.removed_direct_reply_full_quotes
|
||||
|
||||
expect(topic.posts).to eq([post, hidden, small_action, reply])
|
||||
expect(reply.raw).to eq("and this is the third reply")
|
||||
expect(reply.revisions.count).to eq(1)
|
||||
expect(reply.revisions.first.modifications["raw"]).to eq([raw, reply.raw])
|
||||
expect(reply.revisions.first.modifications["edit_reason"][1]).to eq(I18n.t(:removed_direct_reply_full_quotes))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user