about summary refs log tree commit diff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-05-17 21:12:45 -0500
committerStarfall <us@starfall.systems>2021-05-17 21:12:45 -0500
commit2c6fcb9cf8fbb09e900fc3625837529155f98f4f (patch)
treeb78e5204ef455b25c06cde33e8a6846ac46fcdbf /app/models/concerns
parent2523b046523f92ccf12756dce0204926433d1c7f (diff)
parent567745c1e66593ef46a86dc0bcfe824cefb04f14 (diff)
Merge branch 'glitch'
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/account_avatar.rb2
-rw-r--r--app/models/concerns/account_header.rb2
-rw-r--r--app/models/concerns/account_merging.rb6
-rw-r--r--app/models/concerns/remotable.rb2
4 files changed, 9 insertions, 3 deletions
diff --git a/app/models/concerns/account_avatar.rb b/app/models/concerns/account_avatar.rb
index 2d5ebfca3..1af53ed23 100644
--- a/app/models/concerns/account_avatar.rb
+++ b/app/models/concerns/account_avatar.rb
@@ -21,7 +21,7 @@ module AccountAvatar
     has_attached_file :avatar, styles: ->(f) { avatar_styles(f) }, convert_options: { all: '-strip' }, processors: [:lazy_thumbnail]
     validates_attachment_content_type :avatar, content_type: IMAGE_MIME_TYPES
     validates_attachment_size :avatar, less_than: LIMIT
-    remotable_attachment :avatar, LIMIT
+    remotable_attachment :avatar, LIMIT, suppress_errors: false
   end
 
   def avatar_original_url
diff --git a/app/models/concerns/account_header.rb b/app/models/concerns/account_header.rb
index 067e166eb..72a3d0566 100644
--- a/app/models/concerns/account_header.rb
+++ b/app/models/concerns/account_header.rb
@@ -22,7 +22,7 @@ module AccountHeader
     has_attached_file :header, styles: ->(f) { header_styles(f) }, convert_options: { all: '-strip' }, processors: [:lazy_thumbnail]
     validates_attachment_content_type :header, content_type: IMAGE_MIME_TYPES
     validates_attachment_size :header, less_than: LIMIT
-    remotable_attachment :header, LIMIT
+    remotable_attachment :header, LIMIT, suppress_errors: false
   end
 
   def header_original_url
diff --git a/app/models/concerns/account_merging.rb b/app/models/concerns/account_merging.rb
index c3b7018f2..8d37c6e56 100644
--- a/app/models/concerns/account_merging.rb
+++ b/app/models/concerns/account_merging.rb
@@ -15,7 +15,7 @@ module AccountMerging
       Status, StatusPin, MediaAttachment, Poll, Report, Tombstone, Favourite,
       Follow, FollowRequest, Block, Mute, AccountIdentityProof,
       AccountModerationNote, AccountPin, AccountStat, ListAccount,
-      PollVote, Mention, AccountDeletionRequest, AccountNote
+      PollVote, Mention, AccountDeletionRequest, AccountNote, FollowRecommendationSuppression
     ]
 
     owned_classes.each do |klass|
@@ -43,6 +43,10 @@ module AccountMerging
       end
     end
 
+    CanonicalEmailBlock.where(reference_account_id: other_account.id).find_each do |record|
+      record.update_attribute(:reference_account_id, id)
+    end
+
     # Some follow relationships have moved, so the cache is stale
     Rails.cache.delete_matched("followers_hash:#{id}:*")
     Rails.cache.delete_matched("relationships:#{id}:*")
diff --git a/app/models/concerns/remotable.rb b/app/models/concerns/remotable.rb
index 56b9c0164..ffe8a7565 100644
--- a/app/models/concerns/remotable.rb
+++ b/app/models/concerns/remotable.rb
@@ -28,9 +28,11 @@ module Remotable
           end
         rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError => e
           Rails.logger.debug "Error fetching remote #{attachment_name}: #{e}"
+          public_send("#{attachment_name}=", nil) if public_send("#{attachment_name}_file_name").present?
           raise e unless suppress_errors
         rescue Paperclip::Errors::NotIdentifiedByImageMagickError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, Paperclip::Error, Mastodon::DimensionsValidationError, Mastodon::StreamValidationError => e
           Rails.logger.debug "Error fetching remote #{attachment_name}: #{e}"
+          public_send("#{attachment_name}=", nil) if public_send("#{attachment_name}_file_name").present?
         end
 
         nil