From 301a452d9f1f73d8f7b8cb8b898ab465efa6cc71 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 31 Oct 2020 10:39:42 -0700 Subject: [PATCH] Send Delete activity, not Tombstone on deletion --- bookwyrm/activitypub/verbs.py | 1 - bookwyrm/models/base_model.py | 14 ++++++++++++++ bookwyrm/outgoing.py | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bookwyrm/activitypub/verbs.py b/bookwyrm/activitypub/verbs.py index bd6d882d3..eb166260f 100644 --- a/bookwyrm/activitypub/verbs.py +++ b/bookwyrm/activitypub/verbs.py @@ -26,7 +26,6 @@ class Delete(Verb): ''' Create activity ''' to: List cc: List - signature: Signature type: str = 'Delete' diff --git a/bookwyrm/models/base_model.py b/bookwyrm/models/base_model.py index 7d3cb344b..8150d650c 100644 --- a/bookwyrm/models/base_model.py +++ b/bookwyrm/models/base_model.py @@ -108,6 +108,20 @@ class ActivitypubMixin: ).serialize() + def to_delete_activity(self, user): + ''' notice of deletion ''' + # this should be a tombstone + activity_object = self.to_activity() + + return activitypub.Delete( + id=self.remote_id + '/activity', + actor=user.remote_id, + to=['%s/followers' % user.remote_id], + cc=['https://www.w3.org/ns/activitystreams#Public'], + object=activity_object, + ).serialize() + + def to_update_activity(self, user): ''' wrapper for Updates to an activity ''' activity_id = '%s#update/%s' % (user.remote_id, uuid4()) diff --git a/bookwyrm/outgoing.py b/bookwyrm/outgoing.py index 908f3b5bf..d236819e2 100644 --- a/bookwyrm/outgoing.py +++ b/bookwyrm/outgoing.py @@ -204,7 +204,7 @@ def handle_imported_book(user, item, include_reviews, privacy): def handle_delete_status(user, status): ''' delete a status and broadcast deletion to other servers ''' delete_status(status) - broadcast(user, status.to_activity()) + broadcast(user, status.to_delete_activity(user)) def handle_status(user, form):