cleans up urls and views

This commit is contained in:
Mouse Reeve
2020-02-22 14:02:03 -08:00
parent 808ca0bd60
commit 76d2e20742
8 changed files with 216 additions and 200 deletions

View File

@ -108,8 +108,11 @@ def inbox(request, username):
''' incoming activitypub events '''
# TODO: should do some kind of checking if the user accepts
# this action from the sender probably? idk
# but this will just throw an error if the user doesn't exist I guess
models.User.objects.get(localname=username)
# but this will just throw a 404 if the user doesn't exist
try:
models.User.objects.get(localname=username)
except models.User.DoesNotExist:
return HttpResponseNotFound()
return shared_inbox(request)
@ -120,7 +123,10 @@ def get_actor(request, username):
if request.method != 'GET':
return HttpResponseBadRequest()
user = models.User.objects.get(localname=username)
try:
user = models.User.objects.get(localname=username)
except models.User.DoesNotExist:
return HttpResponseNotFound()
return JsonResponse(activitypub.get_actor(user))