FIX: Don't validate approved posts.
A moderator has already validated them. Otherwise we hit things like rate limits.
This commit is contained in:
parent
dc6b2df2a2
commit
f600ead587
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue