NewPostManager determines whether to queue a post or not

This commit is contained in:
Robin Ward
2015-03-31 12:58:56 -04:00
parent a5ee45ccbe
commit 19a9a8b408
15 changed files with 354 additions and 83 deletions

View File

@ -134,6 +134,8 @@ class PostCreator
track_latest_on_category
enqueue_jobs
BadgeGranter.queue_badge_grant(Badge::Trigger::PostRevision, post: @post)
trigger_after_events(@post)
end
if @post || @spam
@ -169,6 +171,11 @@ class PostCreator
protected
def trigger_after_events(post)
DiscourseEvent.trigger(:topic_created, post.topic, @opts, @user) unless @opts[:topic_id]
DiscourseEvent.trigger(:post_created, post, @opts, @user)
end
def transaction(&blk)
Post.transaction do
if new_topic?