FIX: Don't validate approved posts.

A moderator has already validated them. Otherwise we hit things like
rate limits.
This commit is contained in:
Robin Ward 2015-04-21 11:59:35 -04:00
parent dc6b2df2a2
commit f600ead587
2 changed files with 6 additions and 1 deletions

View File

@ -51,7 +51,7 @@ class QueuedPost < ActiveRecord::Base
QueuedPost.transaction do QueuedPost.transaction do
change_to!(:approved, approved_by) change_to!(:approved, approved_by)
creator = PostCreator.new(user, create_options) creator = PostCreator.new(user, create_options.merge(skip_validations: true))
created_post = creator.create created_post = creator.create
end end
created_post created_post

View File

@ -41,7 +41,12 @@ describe QueuedPost do
# We can't approve twice # We can't approve twice
expect(-> { qp.approve!(admin) }).to raise_error(QueuedPost::InvalidStateTransition) expect(-> { qp.approve!(admin) }).to raise_error(QueuedPost::InvalidStateTransition)
end
it "skips validations" do
qp.post_options[:title] = 'too short'
post = qp.approve!(admin)
expect(post).to be_present
end end
it "follows the correct workflow for rejection" do it "follows the correct workflow for rejection" do