FEATURE: fix avatar in quotes when changing avatars
This commit is contained in:
parent
b861669ceb
commit
588667b1e4
|
@ -0,0 +1,11 @@
|
||||||
|
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.where(id: post_ids_to_rebake).find_each.map(&:rebake!)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -645,6 +645,8 @@ class User < ActiveRecord::Base
|
||||||
if SiteSetting.automatically_download_gravatars? && !avatar.last_gravatar_download_attempt
|
if SiteSetting.automatically_download_gravatars? && !avatar.last_gravatar_download_attempt
|
||||||
Jobs.enqueue(:update_gravatar, user_id: self.id, avatar_id: avatar.id)
|
Jobs.enqueue(:update_gravatar, user_id: self.id, avatar_id: avatar.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Jobs.enqueue(:fix_avatar_in_quotes, user_id: self.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def first_post_created_at
|
def first_post_created_at
|
||||||
|
|
Loading…
Reference in New Issue