mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
FIX: 'only_hidden_tags_changed?' method returned 'true' even when tags are not changed.
While editing the first post it does't bumped the topic when the new post revision created. Because we wrongly assumed that the hidden tags are changed even when no tags are updated.
This commit is contained in:
@ -190,6 +190,12 @@ describe PostRevisor do
|
||||
expect(post.public_version).to eq(1)
|
||||
expect(post.revisions.size).to eq(0)
|
||||
end
|
||||
|
||||
it "should bump the topic" do
|
||||
expect {
|
||||
subject.revise!(post.user, { raw: 'updated body' }, revised_at: post.updated_at + SiteSetting.editing_grace_period + 1.seconds)
|
||||
}.to change { post.topic.bumped_at }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'revision much later' do
|
||||
@ -783,6 +789,13 @@ describe PostRevisor do
|
||||
}.to_not change { topic.reload.bumped_at }
|
||||
end
|
||||
|
||||
it "should bump topic if non staff-only tags are added" do
|
||||
expect {
|
||||
result = subject.revise!(Fabricate(:admin), raw: post.raw, tags: topic.tags.map(&:name) + [Fabricate(:tag).name])
|
||||
expect(result).to eq(true)
|
||||
}.to change { topic.reload.bumped_at }
|
||||
end
|
||||
|
||||
it "creates a hidden revision" do
|
||||
subject.revise!(Fabricate(:admin), raw: post.raw, tags: topic.tags.map(&:name) + ['secret'])
|
||||
expect(post.reload.revisions.first.hidden).to eq(true)
|
||||
|
Reference in New Issue
Block a user