FIX: Don't lock wiki posts when they're edited

This commit is contained in:
Robin Ward 2018-03-05 14:50:06 -05:00
parent 0f66a99eb2
commit 17a615165c
2 changed files with 11 additions and 0 deletions

View File

@ -169,6 +169,7 @@ class PostRevisor
# Lock the post by default if the appropriate setting is true
if (
SiteSetting.staff_edit_locks_post? &&
!@post.wiki? &&
@fields.has_key?('raw') &&
@editor.staff? &&
!@post.user.staff?

View File

@ -452,6 +452,16 @@ describe PostRevisor do
expect(post).to be_locked
end
it "doesn't wiki posts" do
post.wiki = true
result = subject.revise!(
moderator,
raw: "some new raw content"
)
expect(result).to eq(true)
post.reload
expect(post).not_to be_locked
end
it "doesn't lock the post when the raw did not change" do
result = subject.revise!(
moderator,