Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Neff <benjamin@coding4coffee.ch>2021-10-24 17:16:14 +0300
committerBenjamin Neff <benjamin@coding4coffee.ch>2021-10-25 04:34:03 +0300
commit3cb1e470a47e03d7e34bfc46d8f306f0a0d1e507 (patch)
tree34041a50fe25d9e31d2b8c68c6e1f083bc473a98 /lib
parent88e2e593a428050b4de563e75bf0f4df417f1d93 (diff)
Resend AccountMigration or AccountDeletion for closed recipients
Diffstat (limited to 'lib')
-rw-r--r--lib/diaspora/federation.rb4
-rw-r--r--lib/diaspora/federation/receive.rb9
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/diaspora/federation.rb b/lib/diaspora/federation.rb
index 1a1bd96b9..8a5bd9ac4 100644
--- a/lib/diaspora/federation.rb
+++ b/lib/diaspora/federation.rb
@@ -9,6 +9,10 @@ module Diaspora
# Raised, if the author of the existing object doesn't match the received author
class InvalidAuthor < RuntimeError
end
+
+ # Raised, if the recipient account is closed already
+ class RecipientClosed < RuntimeError
+ end
end
end
diff --git a/lib/diaspora/federation/receive.rb b/lib/diaspora/federation/receive.rb
index 7148c2521..80773ac95 100644
--- a/lib/diaspora/federation/receive.rb
+++ b/lib/diaspora/federation/receive.rb
@@ -9,6 +9,15 @@ module Diaspora
public_send(Mappings.receiver_for(entity), entity)
end
+ def self.handle_closed_recipient(sender, recipient)
+ return unless recipient.closed_account?
+
+ entity = recipient.person.account_migration || recipient.person.account_deletion
+ Diaspora::Federation::Dispatcher.build(recipient, entity, subscribers: [sender]).dispatch if entity.present?
+
+ raise Diaspora::Federation::RecipientClosed
+ end
+
def self.account_deletion(entity)
person = author_of(entity)
AccountDeletion.create!(person: person) unless AccountDeletion.where(person: person).exists?