diff --git a/app/models/post.rb b/app/models/post.rb index 890edc39ee2..d959aadbd65 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -536,7 +536,7 @@ class Post < ActiveRecord::Base revise( actor, { raw: self.raw, user_id: new_user.id, edit_reason: edit_reason }, - bypass_bump: true, skip_revision: skip_revision + bypass_bump: true, skip_revision: skip_revision, skip_validations: true ) if post_number == topic.highest_post_number diff --git a/spec/services/post_owner_changer_spec.rb b/spec/services/post_owner_changer_spec.rb index f4896ea1972..fb507dca7a0 100644 --- a/spec/services/post_owner_changer_spec.rb +++ b/spec/services/post_owner_changer_spec.rb @@ -62,6 +62,14 @@ describe PostOwnerChanger do expect(p2.revisions.size).to eq(0) end + it "changes the user even when the post does not pass validation" do + p1.update_attribute(:raw, "foo") + PostOwnerChanger.new(post_ids: [p1.id], topic_id: topic.id, new_owner: user_a, acting_user: editor).change_owner! + p1.reload + + expect(p1.user).to eq(user_a) + end + context "integration tests" do let(:p1user) { p1.user } let(:p2user) { p2.user }