Skip to content

A platform for community discussion. Free, open, simple.

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

Robin Ward17a615165c1d
diff --git a/lib/post_revisor.rb b/lib/post_revisor.rb
index 22fa2dd0e06..6e024a4c016 100644
--- a/lib/post_revisor.rb
+++ b/lib/post_revisor.rb
@@ -169,6 +169,7 @@ class PostRevisor
# Lock the post by default if the appropriate setting is true
if (
SiteSetting.staff_edit_locks_post? &&
@fields.has_key?('raw') &&
@editor.staff? &&
diff --git a/spec/components/post_revisor_spec.rb b/spec/components/post_revisor_spec.rb
index 82a239677e4..b8be5cf46ec 100644
--- a/spec/components/post_revisor_spec.rb
+++ b/spec/components/post_revisor_spec.rb
@@ -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,