BUGFIX: New status posts weren't using PostCreator

This commit is contained in:
Robin Ward
2013-03-28 16:40:54 -04:00
parent 473a64d39d
commit a819a26f34
5 changed files with 17 additions and 13 deletions

View File

@@ -322,12 +322,16 @@ class Topic < ActiveRecord::Base
def add_moderator_post(user, text, opts={})
new_post = nil
Topic.transaction do
new_post = posts.create(user: user, raw: text, post_type: Post.types[:moderator_action], no_bump: opts[:bump].blank?)
creator = PostCreator.new(user,
raw: text,
post_type: Post.types[:moderator_action],
no_bump: opts[:bump].blank?,
topic_id: self.id)
new_post = creator.create
increment!(:moderator_posts_count)
new_post
end
if new_post.present?
# If we are moving posts, we want to insert the moderator post where the previous posts were
# in the stream, not at the end.