Fixes Favs

This commit is contained in:
Mouse Reeve 2021-02-15 21:41:08 -08:00
parent 606d89d3bd
commit 08c1553e71
6 changed files with 7 additions and 26 deletions

View file

@ -1,20 +0,0 @@
''' boosting and liking posts '''
from dataclasses import dataclass
from .base_activity import ActivityObject
@dataclass(init=False)
class Like(ActivityObject):
''' a user faving an object '''
actor: str
object: str
type: str = 'Like'
@dataclass(init=False)
class Boost(ActivityObject):
''' boosting a status '''
actor: str
object: str
type: str = 'Announce'

View file

@ -8,8 +8,6 @@ from .image import Image
@dataclass(init=False)
class Tombstone(ActivityObject):
''' the placeholder for a deleted status '''
published: str
deleted: str
type: str = 'Tombstone'

View file

@ -5,6 +5,7 @@ from typing import List
from .base_activity import ActivityObject, Signature
from .book import Edition
@dataclass(init=False)
class Verb(ActivityObject):
''' generic fields for activities - maybe an unecessary level of

View file

@ -128,7 +128,7 @@ class ActivitypubRelatedFieldMixin(ActivitypubFieldMixin):
return related_model.find_existing(value)
# this is an activitypub object, which we can deserialize
activity_serializer = related_model.activity_serializer
return activity_serializer(**value).to_model(related_model)
return activity_serializer(**value).to_model()
try:
# make sure the value looks like a remote id
validate_remote_id(value)

View file

@ -364,4 +364,4 @@ def get_remote_reviews(outbox):
for activity in data['orderedItems']:
if not activity['type'] == 'Review':
continue
activitypub.Review(**activity).to_model(Review)
activitypub.Review(**activity).to_model()

View file

@ -424,7 +424,7 @@ class Inbox(TestCase):
'type': 'Delete',
'id': '%s/activity' % self.status.remote_id,
'actor': self.remote_user.remote_id,
'object': {'id': self.status.remote_id},
'object': {'id': self.status.remote_id, 'type': 'Tombstone'},
}
views.inbox.activity_task(activity)
# deletion doens't remove the status, it turns it into a tombstone
@ -453,7 +453,7 @@ class Inbox(TestCase):
'type': 'Delete',
'id': '%s/activity' % self.status.remote_id,
'actor': self.remote_user.remote_id,
'object': {'id': self.status.remote_id},
'object': {'id': self.status.remote_id, 'type': 'Tombstone'},
}
views.inbox.activity_task(activity)
# deletion doens't remove the status, it turns it into a tombstone
@ -472,6 +472,7 @@ class Inbox(TestCase):
'@context': 'https://www.w3.org/ns/activitystreams',
'id': 'https://example.com/fav/1',
'actor': 'https://example.com/users/rat',
'type': 'Like',
'published': 'Mon, 25 May 2020 19:31:20 GMT',
'object': 'https://example.com/status/1',
}
@ -492,6 +493,7 @@ class Inbox(TestCase):
'@context': 'https://www.w3.org/ns/activitystreams',
'id': 'https://example.com/fav/1',
'actor': 'https://example.com/users/rat',
'type': 'Like',
'published': 'Mon, 25 May 2020 19:31:20 GMT',
'object': 'https://example.com/fav/1',
}