Browse Source

Properly delete remote account's avatar/header when fetch/update (#18973)

closed-social-glitch-2
Jeong Arm 2 years ago
committed by GitHub
parent
commit
6aa83b13ba
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      app/services/activitypub/process_account_service.rb

+ 2
- 0
app/services/activitypub/process_account_service.rb View File

@ -105,11 +105,13 @@ class ActivityPub::ProcessAccountService < BaseService
def set_fetchable_attributes! def set_fetchable_attributes!
begin begin
@account.avatar_remote_url = image_url('icon') || '' unless skip_download? @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 rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError
RedownloadAvatarWorker.perform_in(rand(30..600).seconds, @account.id) RedownloadAvatarWorker.perform_in(rand(30..600).seconds, @account.id)
end end
begin begin
@account.header_remote_url = image_url('image') || '' unless skip_download? @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 rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError
RedownloadHeaderWorker.perform_in(rand(30..600).seconds, @account.id) RedownloadHeaderWorker.perform_in(rand(30..600).seconds, @account.id)
end end

Loading…
Cancel
Save