Improve follower/following management
This commit is contained in:
18
core/meta.py
18
core/meta.py
@@ -18,6 +18,13 @@ class Box(Enum):
|
||||
REPLIES = "replies"
|
||||
|
||||
|
||||
@unique
|
||||
class FollowStatus(Enum):
|
||||
WAITING = "waiting"
|
||||
ACCEPTED = "accepted"
|
||||
REJECTED = "rejected"
|
||||
|
||||
|
||||
@unique
|
||||
class MetaKey(Enum):
|
||||
NOTIFICATION = "notification"
|
||||
@@ -38,6 +45,9 @@ class MetaKey(Enum):
|
||||
OBJECT_ACTOR_ID = "object_actor_id"
|
||||
OBJECT_ACTOR_HASH = "object_actor_hash"
|
||||
PUBLIC = "public"
|
||||
|
||||
FOLLOW_STATUS = "follow_status"
|
||||
|
||||
THREAD_ROOT_PARENT = "thread_root_parent"
|
||||
|
||||
IN_REPLY_TO_SELF = "in_reply_to_self"
|
||||
@@ -83,6 +93,10 @@ def by_type(type_: Union[ap.ActivityType, List[ap.ActivityType]]) -> _SubQuery:
|
||||
return {"type": type_.value}
|
||||
|
||||
|
||||
def follow_request_accepted() -> _SubQuery:
|
||||
return flag(MetaKey.FOLLOW_STATUS, FollowStatus.ACCEPTED.value)
|
||||
|
||||
|
||||
def not_undo() -> _SubQuery:
|
||||
return flag(MetaKey.UNDO, False)
|
||||
|
||||
@@ -95,6 +109,10 @@ def by_actor(actor: ap.BaseActivity) -> _SubQuery:
|
||||
return flag(MetaKey.ACTOR_ID, actor.id)
|
||||
|
||||
|
||||
def by_actor_id(actor_id: str) -> _SubQuery:
|
||||
return flag(MetaKey.ACTOR_ID, actor_id)
|
||||
|
||||
|
||||
def by_object_id(object_id: str) -> _SubQuery:
|
||||
return flag(MetaKey.OBJECT_ID, object_id)
|
||||
|
||||
|
Reference in New Issue
Block a user