View for handling follow requests

This commit is contained in:
Jason McBrayer 2019-03-05 18:45:14 -05:00
parent c192d0056e
commit d3ed8eef27
1 changed files with 20 additions and 4 deletions

View File

@ -972,10 +972,7 @@ def emoji_reference(request):
@br_login_required @br_login_required
def list_filters(request): def list_filters(request):
try: account, mastodon = get_usercontext(request)
account, mastodon = get_usercontext(request)
except NotLoggedInException:
return redirect(about)
filters = mastodon.filters() filters = mastodon.filters()
return render(request, 'filters/list.html', return render(request, 'filters/list.html',
{'account': account, {'account': account,
@ -1079,3 +1076,22 @@ def edit_filter(request, id):
'account': account, 'account': account,
'filter': filter, 'filter': filter,
'preferences': account.preferences}) 'preferences': account.preferences})
@br_login_required
def follow_requests(request, id=None):
account, mastodon = get_usercontext(request)
if request.method == 'GET':
reqs = mastodon.follow_requests()
return render(request, 'requests/list.html',
{'account': account,
'preferences': account.preferences,
'requests': reqs})
elif id is None:
return redirect(follow_requests)
else:
if request.POST.get("accept", None):
mastodon.follow_request_authorize(id)
elif request.POST.get("rejest", None):
mastodon.follow_request_reject(id)
return redirect(follow_requests)