mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
FIX: Allow changing post owner even when validations fail
This commit is contained in:
parent
3c430a3949
commit
c22e56499a
|
@ -536,7 +536,7 @@ class Post < ActiveRecord::Base
|
||||||
revise(
|
revise(
|
||||||
actor,
|
actor,
|
||||||
{ raw: self.raw, user_id: new_user.id, edit_reason: edit_reason },
|
{ 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
|
if post_number == topic.highest_post_number
|
||||||
|
|
|
@ -62,6 +62,14 @@ describe PostOwnerChanger do
|
||||||
expect(p2.revisions.size).to eq(0)
|
expect(p2.revisions.size).to eq(0)
|
||||||
end
|
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
|
context "integration tests" do
|
||||||
let(:p1user) { p1.user }
|
let(:p1user) { p1.user }
|
||||||
let(:p2user) { p2.user }
|
let(:p2user) { p2.user }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user