A platform for community discussion. Free, open, simple.
FIX: Don't lock a post on edit unless the raw changes
Robin Wardb3883f5c321e
diff --git a/lib/post_revisor.rb b/lib/post_revisor.rbindex 79f9ab17cc2..22fa2dd0e06 100644--- a/lib/post_revisor.rb+++ b/lib/post_revisor.rb@@ -167,9 +167,12 @@ class PostRevisorend# Lock the post by default if the appropriate setting is true- if SiteSetting.staff_edit_locks_post? &&- @editor.staff? &&+ if (+ SiteSetting.staff_edit_locks_post? &&+ @fields.has_key?('raw') &&+ @editor.staff? &&+ )PostLocker.new(@post, @editor).lockenddiff --git a/spec/components/post_revisor_spec.rb b/spec/components/post_revisor_spec.rbindex c9a5eab5633..7fe2547ea3a 100644--- a/spec/components/post_revisor_spec.rb+++ b/spec/components/post_revisor_spec.rb@@ -452,6 +452,18 @@ describe PostRevisor doexpect(post).to be_lockedend+ 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" doresult = subject.revise!(Fabricate(:user),