FIX: Validations could prevent moving posts
This commit is contained in:
parent
8ab6689f43
commit
0ecdf90023
|
@ -128,7 +128,8 @@ class PostMover
|
|||
update[:reply_to_user_id] = nil
|
||||
end
|
||||
|
||||
post.update(update)
|
||||
post.attributes = update
|
||||
post.save(validate: false)
|
||||
|
||||
move_incoming_emails(post, post)
|
||||
move_email_logs(post, post)
|
||||
|
|
|
@ -499,6 +499,17 @@ describe PostMover do
|
|||
end
|
||||
end
|
||||
|
||||
it "skips validations when moving posts" do
|
||||
p1.update_attribute(:raw, "foo")
|
||||
p2.update_attribute(:raw, "bar")
|
||||
|
||||
new_topic = topic.move_posts(user, [p1.id, p2.id], title: "new testing topic name")
|
||||
|
||||
expect(new_topic).to be_present
|
||||
expect(new_topic.posts.by_post_number.first.raw).to eq(p1.raw)
|
||||
expect(new_topic.posts.by_post_number.last.raw).to eq(p2.raw)
|
||||
expect(new_topic.posts_count).to eq(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue