* update User model to allow for moved_to and also_known_as values * allow users to add aliases (also_known_as) in UI * allow users to move account to another one (moved_to) * redirect webfinger to the new account after a move * present notification to followers inviting to follow at new account Note: unlike Mastodon we're not running any unfollow/autofollow action here: users can decide for themselves This makes undoing moves easier. TODO There is still a bug with incoming Moves, at least from Mastodon. This seems to be something to do with Update activities (rather than Move, strictly).
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
""" actor serializer """
|
|
from dataclasses import dataclass, field
|
|
from typing import Dict
|
|
|
|
from .base_activity import ActivityObject
|
|
from .image import Image
|
|
|
|
|
|
# pylint: disable=invalid-name
|
|
@dataclass(init=False)
|
|
class PublicKey(ActivityObject):
|
|
"""public key block"""
|
|
|
|
owner: str
|
|
publicKeyPem: str
|
|
type: str = "PublicKey"
|
|
|
|
def serialize(self, **kwargs):
|
|
"""remove fields"""
|
|
omit = ("type", "@context")
|
|
return super().serialize(omit=omit)
|
|
|
|
|
|
# pylint: disable=invalid-name
|
|
@dataclass(init=False)
|
|
class Person(ActivityObject):
|
|
"""actor activitypub json"""
|
|
|
|
preferredUsername: str
|
|
inbox: str
|
|
publicKey: PublicKey
|
|
followers: str = None
|
|
following: str = None
|
|
outbox: str = None
|
|
endpoints: Dict = None
|
|
name: str = None
|
|
summary: str = None
|
|
icon: Image = field(default_factory=lambda: {})
|
|
bookwyrmUser: bool = False
|
|
manuallyApprovesFollowers: str = False
|
|
discoverable: str = False
|
|
hideFollows: str = False
|
|
movedTo: str = None
|
|
alsoKnownAs: dict[str] = None
|
|
type: str = "Person"
|