diff --git a/lib/post_creator.rb b/lib/post_creator.rb index 0bd6d9e547b..bbe0256ef25 100644 --- a/lib/post_creator.rb +++ b/lib/post_creator.rb @@ -267,11 +267,13 @@ class PostCreator end def update_topic_stats - # Update attributes on the topic - featured users and last posted. - attrs = {last_posted_at: @post.created_at, last_post_user_id: @post.user_id} - attrs[:bumped_at] = @post.created_at unless @post.no_bump - attrs[:word_count] = (@topic.word_count || 0) + @post.word_count + attrs = { + last_posted_at: @post.created_at, + last_post_user_id: @post.user_id, + word_count: (@topic.word_count || 0) + @post.word_count, + } attrs[:excerpt] = @post.excerpt(220, strip_links: true) if new_topic? + attrs[:bumped_at] = @post.created_at unless @post.no_bump @topic.update_attributes(attrs) end @@ -331,8 +333,7 @@ class PostCreator @user.user_stat.save! - @user.last_posted_at = @post.created_at - @user.save! + @user.update_attributes(last_posted_at: @post.created_at) end def publish