forked from mirrors/bookwyrm
Tweaks handle_follow behavior for unknown users
This commit is contained in:
parent
2ce3cae193
commit
cedc79a962
1 changed files with 10 additions and 3 deletions
|
@ -112,9 +112,16 @@ def has_valid_signature(request, activity):
|
||||||
def handle_follow(activity):
|
def handle_follow(activity):
|
||||||
''' someone wants to follow a local user '''
|
''' someone wants to follow a local user '''
|
||||||
# figure out who they want to follow -- not using get_or_create because
|
# figure out who they want to follow -- not using get_or_create because
|
||||||
# we only allow you to follow local users
|
# we only care if you want to follow local users
|
||||||
to_follow = models.User.objects.get(remote_id=activity['object'])
|
try:
|
||||||
# raises models.User.DoesNotExist id the remote id is not found
|
to_follow = models.User.objects.get(remote_id=activity['object'])
|
||||||
|
except models.User.DoesNotExist:
|
||||||
|
# some rando, who cares
|
||||||
|
return
|
||||||
|
if not to_follow.local:
|
||||||
|
# just ignore follow alerts about other servers. maybe they should be
|
||||||
|
# handled. maybe they shouldn't be sent at all.
|
||||||
|
return
|
||||||
|
|
||||||
# figure out who the actor is
|
# figure out who the actor is
|
||||||
user = get_or_create_remote_user(activity['actor'])
|
user = get_or_create_remote_user(activity['actor'])
|
||||||
|
|
Loading…
Reference in a new issue