Adds test for incoming follow request

This commit is contained in:
Mouse Reeve
2020-10-15 17:32:24 -07:00
parent e8ef8f7101
commit db18014325
2 changed files with 53 additions and 5 deletions

View File

@ -124,10 +124,10 @@ def handle_follow(activity):
return
# figure out who the actor is
user = get_or_create_remote_user(activity['actor'])
actor = get_or_create_remote_user(activity['actor'])
try:
relationship = models.UserFollowRequest.objects.create(
user_subject=user,
user_subject=actor,
user_object=to_follow,
relationship_id=activity['id']
)
@ -143,14 +143,15 @@ def handle_follow(activity):
status_builder.create_notification(
to_follow,
'FOLLOW',
related_user=user
related_user=actor
)
outgoing.handle_accept(user, to_follow, relationship)
outgoing.handle_accept(actor, to_follow, relationship)
else:
# Accept will be triggered manually
status_builder.create_notification(
to_follow,
'FOLLOW_REQUEST',
related_user=user
related_user=actor
)