Fixes Favs
This commit is contained in:
parent
606d89d3bd
commit
08c1553e71
@ -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'
|
|
@ -8,8 +8,6 @@ from .image import Image
|
|||||||
@dataclass(init=False)
|
@dataclass(init=False)
|
||||||
class Tombstone(ActivityObject):
|
class Tombstone(ActivityObject):
|
||||||
''' the placeholder for a deleted status '''
|
''' the placeholder for a deleted status '''
|
||||||
published: str
|
|
||||||
deleted: str
|
|
||||||
type: str = 'Tombstone'
|
type: str = 'Tombstone'
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ from typing import List
|
|||||||
from .base_activity import ActivityObject, Signature
|
from .base_activity import ActivityObject, Signature
|
||||||
from .book import Edition
|
from .book import Edition
|
||||||
|
|
||||||
|
|
||||||
@dataclass(init=False)
|
@dataclass(init=False)
|
||||||
class Verb(ActivityObject):
|
class Verb(ActivityObject):
|
||||||
''' generic fields for activities - maybe an unecessary level of
|
''' generic fields for activities - maybe an unecessary level of
|
||||||
|
@ -128,7 +128,7 @@ class ActivitypubRelatedFieldMixin(ActivitypubFieldMixin):
|
|||||||
return related_model.find_existing(value)
|
return related_model.find_existing(value)
|
||||||
# this is an activitypub object, which we can deserialize
|
# this is an activitypub object, which we can deserialize
|
||||||
activity_serializer = related_model.activity_serializer
|
activity_serializer = related_model.activity_serializer
|
||||||
return activity_serializer(**value).to_model(related_model)
|
return activity_serializer(**value).to_model()
|
||||||
try:
|
try:
|
||||||
# make sure the value looks like a remote id
|
# make sure the value looks like a remote id
|
||||||
validate_remote_id(value)
|
validate_remote_id(value)
|
||||||
|
@ -364,4 +364,4 @@ def get_remote_reviews(outbox):
|
|||||||
for activity in data['orderedItems']:
|
for activity in data['orderedItems']:
|
||||||
if not activity['type'] == 'Review':
|
if not activity['type'] == 'Review':
|
||||||
continue
|
continue
|
||||||
activitypub.Review(**activity).to_model(Review)
|
activitypub.Review(**activity).to_model()
|
||||||
|
@ -424,7 +424,7 @@ class Inbox(TestCase):
|
|||||||
'type': 'Delete',
|
'type': 'Delete',
|
||||||
'id': '%s/activity' % self.status.remote_id,
|
'id': '%s/activity' % self.status.remote_id,
|
||||||
'actor': self.remote_user.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)
|
views.inbox.activity_task(activity)
|
||||||
# deletion doens't remove the status, it turns it into a tombstone
|
# deletion doens't remove the status, it turns it into a tombstone
|
||||||
@ -453,7 +453,7 @@ class Inbox(TestCase):
|
|||||||
'type': 'Delete',
|
'type': 'Delete',
|
||||||
'id': '%s/activity' % self.status.remote_id,
|
'id': '%s/activity' % self.status.remote_id,
|
||||||
'actor': self.remote_user.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)
|
views.inbox.activity_task(activity)
|
||||||
# deletion doens't remove the status, it turns it into a tombstone
|
# 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',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'id': 'https://example.com/fav/1',
|
'id': 'https://example.com/fav/1',
|
||||||
'actor': 'https://example.com/users/rat',
|
'actor': 'https://example.com/users/rat',
|
||||||
|
'type': 'Like',
|
||||||
'published': 'Mon, 25 May 2020 19:31:20 GMT',
|
'published': 'Mon, 25 May 2020 19:31:20 GMT',
|
||||||
'object': 'https://example.com/status/1',
|
'object': 'https://example.com/status/1',
|
||||||
}
|
}
|
||||||
@ -492,6 +493,7 @@ class Inbox(TestCase):
|
|||||||
'@context': 'https://www.w3.org/ns/activitystreams',
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
||||||
'id': 'https://example.com/fav/1',
|
'id': 'https://example.com/fav/1',
|
||||||
'actor': 'https://example.com/users/rat',
|
'actor': 'https://example.com/users/rat',
|
||||||
|
'type': 'Like',
|
||||||
'published': 'Mon, 25 May 2020 19:31:20 GMT',
|
'published': 'Mon, 25 May 2020 19:31:20 GMT',
|
||||||
'object': 'https://example.com/fav/1',
|
'object': 'https://example.com/fav/1',
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user