Fixes issue with featuring topic users

This commit is contained in:
Robin Ward 2013-04-08 10:51:01 -04:00
parent 467d59ec5a
commit 1715aa66d9
1 changed files with 6 additions and 7 deletions

View File

@ -94,12 +94,6 @@ class PostCreator
# Extract links
TopicLink.extract_from(post)
# Enqueue a job to feature the users in the topic
Jobs.enqueue(:feature_topic_users, topic_id: topic.id)
# Trigger post processing
post.trigger_post_process
# Store unique post key
if SiteSetting.unique_posts_mins > 0
$redis.setex(post.unique_post_key, SiteSetting.unique_posts_mins.minutes.to_i, "1")
@ -115,7 +109,6 @@ class PostCreator
# Track the topic
TopicUser.auto_track(@user.id, topic.id, TopicUser.notification_reasons[:created_post])
if @user.id != topic.user_id
@user.update_topic_reply_count
end
@ -137,9 +130,15 @@ class PostCreator
post.save_reply_relationships
end
# We need to enqueue jobs after the transaction. Otherwise they might begin before the data has
# been comitted.
Jobs.enqueue(:feature_topic_users, topic_id: topic.id)
post.trigger_post_process
post
end
# Shortcut
def self.create(user, opts)
PostCreator.new(user, opts).create