mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
Handle follow request accept activities
This commit is contained in:
parent
4f60d27c12
commit
48d92f1990
2 changed files with 13 additions and 3 deletions
|
@ -100,8 +100,7 @@ def shared_inbox(request):
|
|||
return handle_incoming_create(activity)
|
||||
|
||||
if activity['type'] == 'Accept':
|
||||
# aww yay, friendship
|
||||
return HttpResponse()
|
||||
return handle_incoming_follow_accept(activity)
|
||||
|
||||
return HttpResponseNotFound()
|
||||
|
||||
|
@ -267,6 +266,17 @@ def handle_incoming_follow(activity):
|
|||
})
|
||||
|
||||
|
||||
def handle_incoming_follow_accept(activity):
|
||||
''' hurray, someone remote accepted a follow request '''
|
||||
# figure out who they want to follow
|
||||
requester = models.User.objects.get(actor=activity['object']['actor'])
|
||||
# figure out who they are
|
||||
accepter = get_or_create_remote_user(activity['actor'])
|
||||
|
||||
accepter.followers.add(requester)
|
||||
return HttpResponse()
|
||||
|
||||
|
||||
def handle_incoming_create(activity):
|
||||
''' someone did something, good on them '''
|
||||
user = get_or_create_remote_user(activity['actor'])
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<small>{{ user.username }}</small>
|
||||
</h2>
|
||||
{% if user.summary %}
|
||||
<blockquote>{{ user.summary }}</blockquote>
|
||||
<blockquote>{{ user.summary | safe }}</blockquote>
|
||||
{% endif %}
|
||||
{% if not is_self %}
|
||||
{% if not request.user in user.followers.all %}
|
||||
|
|
Loading…
Reference in a new issue