diff --git a/lib/post_revisor.rb b/lib/post_revisor.rb index f20e2864295..3dd7459b501 100644 --- a/lib/post_revisor.rb +++ b/lib/post_revisor.rb @@ -335,6 +335,7 @@ class PostRevisor update_post update_topic if topic_changed? create_or_update_revision + remove_flags_and_unhide_post end USER_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.rb index cf008c30562..228b5fbe0bc 100644 --- a/spec/components/post_revisor_spec.rb +++ b/spec/components/post_revisor_spec.rb @@ -227,6 +227,18 @@ describe PostRevisor do end end + 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: ["
Hello world
", "hello world
"], + raw: ["Hello world", "hello world"] + ) + end + end + describe 'revision much later' do let!(:revised_at) { post.updated_at + 2.minutes }