diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2021-10-29 04:08:01 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2021-11-23 02:43:56 +0300 |
commit | 1570e3fb9afb6d312c94118f5bae5463021d9bae (patch) | |
tree | 3055031428a2691e85dcc4a2ec1a1d1e0dea1df9 /lib | |
parent | c67fc4e0f77cd687c314184c33c08b5e3f2594ed (diff) |
Migrate remote_photo_path and cleanup old photo uploads
If the migration contains a new remote_photo_path migrate all photos of
the old person to this path. If the person was local before, cleanup old
uploaded files of the photos.
closes #8314
Diffstat (limited to 'lib')
-rw-r--r-- | lib/diaspora/federation/receive.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/diaspora/federation/receive.rb b/lib/diaspora/federation/receive.rb index edbdf2b9f..dd136ac42 100644 --- a/lib/diaspora/federation/receive.rb +++ b/lib/diaspora/federation/receive.rb @@ -31,7 +31,11 @@ module Diaspora profile = profile(entity.profile) return if AccountMigration.exists?(old_person: old_person, new_person: profile.person) - AccountMigration.create!(old_person: old_person, new_person: profile.person).tap do |migration| + AccountMigration.create!( + old_person: old_person, + new_person: profile.person, + remote_photo_path: entity.remote_photo_path + ).tap do |migration| migration.signature = entity.signature if old_person.local? migration.save! end |