mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 03:51:08 +00:00
Fixes serialization of delete activity
This commit is contained in:
parent
ae81d6cf71
commit
cb21099e0b
3 changed files with 2 additions and 12 deletions
|
@ -369,16 +369,6 @@ class OrderedCollectionMixin(OrderedCollectionPageMixin):
|
|||
if self.user.local and broadcast:
|
||||
self.broadcast(activity, self.user)
|
||||
|
||||
def to_delete_activity(self, user):
|
||||
"""notice of deletion"""
|
||||
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=self.remote_id,
|
||||
).serialize()
|
||||
|
||||
|
||||
class CollectionItemMixin(ActivitypubMixin):
|
||||
"""for items that are part of an (Ordered)Collection"""
|
||||
|
|
|
@ -142,7 +142,7 @@ class InboxActivities(TestCase):
|
|||
"type": "Delete",
|
||||
"actor": "https://example.com/users/test-user",
|
||||
"to": ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
"object": book_list.remote_id,
|
||||
"object": {"id": book_list.remote_id, "type": "List"}
|
||||
}
|
||||
views.inbox.activity_task(activity)
|
||||
self.assertFalse(models.List.objects.exists())
|
||||
|
|
|
@ -90,7 +90,7 @@ class ListActionViews(TestCase):
|
|||
activity = json.loads(mock.call_args[0][1])
|
||||
self.assertEqual(activity["type"], "Delete")
|
||||
self.assertEqual(activity["actor"], self.local_user.remote_id)
|
||||
self.assertEqual(activity["object"], self.list.remote_id)
|
||||
self.assertEqual(activity["object"]["id"], self.list.remote_id)
|
||||
|
||||
self.assertEqual(mock.call_count, 1)
|
||||
self.assertFalse(models.List.objects.exists())
|
||||
|
|
Loading…
Reference in a new issue