A platform for community discussion. Free, open, simple.
FIX: Post reviser picking up edits for hidden posts (#8792)
Mark VanLandingham20e3c0f38628
diff --git a/lib/post_revisor.rb b/lib/post_revisor.rbindex f20e2864295..3dd7459b501 100644--- a/lib/post_revisor.rb+++ b/lib/post_revisor.rb@@ -335,6 +335,7 @@ class PostRevisorupdate_postupdate_topic if topic_changed?create_or_update_revision+ remove_flags_and_unhide_postendUSER_ACTIONS_TO_REMOVE ||= [UserAction::REPLY, UserAction::RESPONSE]@@ -365,8 +366,6 @@ class PostRevisor@post.word_count = @fields[:raw].scan(/[[:word:]]+/).size if @fields.has_key?(:raw)@post.self_edits += 1 if self_edit?- remove_flags_and_unhide_post-@post.extract_quoted_post_numbers@post_successfully_saved = @post.save(validate: @validate_post)diff --git a/spec/components/post_revisor_spec.rb b/spec/components/post_revisor_spec.rbindex cf008c30562..228b5fbe0bc 100644--- a/spec/components/post_revisor_spec.rb+++ b/spec/components/post_revisor_spec.rb@@ -227,6 +227,18 @@ describe PostRevisor doendend+ describe 'hidden post' do+ it "correctly stores the modification value" do+ post.update(hidden: true, hidden_reason_id: Post.hidden_reasons[:flag_threshold_reached])+ revisor = PostRevisor.new(post)+ revisor.revise!(post.user, { raw: 'hello world' }, revised_at: post.updated_at + 11.minutes)+ expect(post.revisions.first.modifications.symbolize_keys).to eq(+ cooked: ["<p>Hello world</p>", "<p>hello world</p>"],+ raw: ["Hello world", "hello world"]+ )+ end+ end+describe 'revision much later' dolet!(:revised_at) { post.updated_at + 2.minutes }