mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: reset edit_reason
in posts when creating a new version.
This commit is contained in:
@ -208,6 +208,19 @@ describe PostRevisor do
|
||||
expect(post.revisions.count).to eq(1)
|
||||
end
|
||||
|
||||
it "resets the edit_reason attribute in post model" do
|
||||
SiteSetting.editing_grace_period = 5
|
||||
post = Fabricate(:post, raw: 'hello world')
|
||||
revisor = PostRevisor.new(post)
|
||||
revisor.revise!(post.user, { raw: 'hello world123456789', edit_reason: 'this is my reason' }, revised_at: post.updated_at + 1.second)
|
||||
post.reload
|
||||
expect(post.edit_reason).to eq('this is my reason')
|
||||
|
||||
revisor.revise!(post.user, { raw: 'hello world4321' }, revised_at: post.updated_at + 6.second)
|
||||
post.reload
|
||||
expect(post.edit_reason).not_to be_present
|
||||
end
|
||||
|
||||
it "does not create a new version if an edit reason is provided and its the same as the current edit reason" do
|
||||
post = Fabricate(:post, raw: 'hello world', edit_reason: 'this is my reason')
|
||||
revisor = PostRevisor.new(post)
|
||||
|
Reference in New Issue
Block a user