]> cat aescling's git repositories - mastodon.git/commitdiff
Properly delete remote account's avatar/header when fetch/update (#18973)
authorJeong Arm <kjwonmail@gmail.com>
Mon, 15 Aug 2022 18:32:21 +0000 (03:32 +0900)
committeraescling <aescling+gitlab@cat.family>
Mon, 5 Sep 2022 04:27:59 +0000 (00:27 -0400)
app/services/activitypub/process_account_service.rb

index 4449a54270143a70fa98af94cabdc79fbf3ffb96..34750dba6bd577899a5a4692d0a9edbd6f54bead 100644 (file)
@@ -105,11 +105,13 @@ class ActivityPub::ProcessAccountService < BaseService
   def set_fetchable_attributes!
     begin
       @account.avatar_remote_url = image_url('icon') || '' unless skip_download?
+      @account.avatar = nil if @account.avatar_remote_url.blank?
     rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError
       RedownloadAvatarWorker.perform_in(rand(30..600).seconds, @account.id)
     end
     begin
       @account.header_remote_url = image_url('image') || '' unless skip_download?
+      @account.header = nil if @account.header_remote_url.blank?
     rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError
       RedownloadHeaderWorker.perform_in(rand(30..600).seconds, @account.id)
     end