FIX: Don't lock a post on edit unless the raw changes
This commit is contained in:
parent
5c93d07d2a
commit
b3883f5c32
|
@ -167,9 +167,12 @@ class PostRevisor
|
||||||
end
|
end
|
||||||
|
|
||||||
# Lock the post by default if the appropriate setting is true
|
# Lock the post by default if the appropriate setting is true
|
||||||
if SiteSetting.staff_edit_locks_post? &&
|
if (
|
||||||
@editor.staff? &&
|
SiteSetting.staff_edit_locks_post? &&
|
||||||
!@post.user.staff?
|
@fields.has_key?('raw') &&
|
||||||
|
@editor.staff? &&
|
||||||
|
!@post.user.staff?
|
||||||
|
)
|
||||||
PostLocker.new(@post, @editor).lock
|
PostLocker.new(@post, @editor).lock
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -452,6 +452,18 @@ describe PostRevisor do
|
||||||
expect(post).to be_locked
|
expect(post).to be_locked
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "doesn't lock the post when the raw did not change" do
|
||||||
|
result = subject.revise!(
|
||||||
|
moderator,
|
||||||
|
title: "New topic title, cool!"
|
||||||
|
)
|
||||||
|
expect(result).to eq(true)
|
||||||
|
post.reload
|
||||||
|
expect(post.topic.title).to eq("New topic title, cool!")
|
||||||
|
expect(post).not_to be_locked
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
it "doesn't lock the post when revised by a regular user" do
|
it "doesn't lock the post when revised by a regular user" do
|
||||||
result = subject.revise!(
|
result = subject.revise!(
|
||||||
Fabricate(:user),
|
Fabricate(:user),
|
||||||
|
|
Loading…
Reference in New Issue