Add support for manually approving followers

Fixes #61
This commit is contained in:
Thomas Sileo
2019-10-20 20:47:35 +02:00
parent e265704e03
commit 95e411ac9b
6 changed files with 73 additions and 19 deletions

View File

@@ -825,3 +825,24 @@ def handle_replies(create: ap.Create) -> None:
# Spawn a task to process it (and determine if it needs to be saved)
Tasks.process_reply(create.get_object_id())
def accept_follow(activity: ap.BaseActivity) -> str:
actor_id = activity.get_actor().id
accept = ap.Accept(
actor=ID,
context=new_context(activity),
object={
"type": "Follow",
"id": activity.id,
"object": activity.get_object_id(),
"actor": actor_id,
},
to=[actor_id],
published=now(),
)
update_one_activity(
by_remote_id(activity.id),
upsert({MetaKey.FOLLOW_STATUS: FollowStatus.ACCEPTED.value}),
)
return post_to_outbox(accept)