1
0
Fork 0

initial work to add 'Move' activity

This commit is contained in:
Hugh Rundle 2023-08-29 21:07:41 +10:00
parent e5f8e4babc
commit e7ba6a3141
No known key found for this signature in database
GPG key ID: A7E35779918253F9
6 changed files with 121 additions and 1 deletions

View file

@ -19,6 +19,7 @@ from .verbs import Create, Delete, Undo, Update
from .verbs import Follow, Accept, Reject, Block
from .verbs import Add, Remove
from .verbs import Announce, Like
from .verbs import Move
# this creates a list of all the Activity types that we can serialize,
# so when an Activity comes in from outside, we can check if it's known

View file

@ -231,3 +231,28 @@ class Announce(Verb):
def action(self, allow_external_connections=True):
"""boost"""
self.to_model(allow_external_connections=allow_external_connections)
@dataclass(init=False)
class Move(Verb):
"""a user moving an object"""
# note the spec example for target and origin is an object but
# Mastodon uses a URI string and TBH this makes more sense
# Is there a way we can account for either format?
object: str
type: str = "Move"
target: str
origin: str
def action(self, allow_external_connections=True):
"""move"""
# we need to work out whether the object is a user or something else.
object_is_user = True # TODO!
if object_is_user:
self.to_model(object_is_user=True allow_external_connections=allow_external_connections)
else:
self.to_model(object_is_user=False allow_external_connections=allow_external_connections)