fix the build

This commit is contained in:
Régis Hanol 2015-03-30 12:48:20 +02:00
parent 588667b1e4
commit 10b8eca9a6
2 changed files with 4 additions and 3 deletions

View File

@ -2,8 +2,7 @@ module Jobs
class FixAvatarInQuotes < Jobs::Base
def execute(args)
user = User.find(args[:user_id])
post_ids_to_rebake = Post.exec_sql("SELECT post_id FROM quoted_posts WHERE quoted_post_id IN (SELECT id FROM posts WHERE user_id = ?)", user.id).values.flatten.map(&:to_i)
post_ids_to_rebake = Post.exec_sql("SELECT post_id FROM quoted_posts WHERE quoted_post_id IN (SELECT id FROM posts WHERE user_id = ?)", args[:user_id]).values.flatten.map(&:to_i)
Post.where(id: post_ids_to_rebake).find_each.map(&:rebake!)
end

View File

@ -646,8 +646,10 @@ class User < ActiveRecord::Base
Jobs.enqueue(:update_gravatar, user_id: self.id, avatar_id: avatar.id)
end
if self.uploaded_avatar_id_changed?
Jobs.enqueue(:fix_avatar_in_quotes, user_id: self.id)
end
end
def first_post_created_at
user_stat.try(:first_post_created_at)