diff options
author | Andrew Godwin | 2022-11-09 23:48:31 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-09 23:48:31 -0700 |
commit | 2c3a1299709f2612e96c37e4e121c83ad4df7a56 (patch) | |
tree | 89c2aed22a7a10730e02c809f83b744a21e295e1 /users/views | |
parent | 7746abbbb7700fa918450101bbc6d29ed9b4b608 (diff) | |
download | takahe-2c3a1299709f2612e96c37e4e121c83ad4df7a56.tar.gz takahe-2c3a1299709f2612e96c37e4e121c83ad4df7a56.tar.bz2 takahe-2c3a1299709f2612e96c37e4e121c83ad4df7a56.zip |
Profile fetching now working on state machine
Diffstat (limited to 'users/views')
-rw-r--r-- | users/views/identity.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/users/views/identity.py b/users/views/identity.py index d02505f..3e69dae 100644 --- a/users/views/identity.py +++ b/users/views/identity.py @@ -17,7 +17,7 @@ from core.forms import FormHelper from core.ld import canonicalise from core.signatures import HttpSignature from users.decorators import identity_required -from users.models import Domain, Follow, Identity, IdentityStates +from users.models import Domain, Follow, Identity, IdentityStates, InboxMessage from users.shortcuts import by_handle_or_404 @@ -117,9 +117,13 @@ class CreateIdentity(FormView): def clean(self): # Check for existing users - username = self.cleaned_data["username"] - domain = self.cleaned_data["domain"] - if Identity.objects.filter(username=username, domain=domain).exists(): + username = self.cleaned_data.get("username") + domain = self.cleaned_data.get("domain") + if ( + username + and domain + and Identity.objects.filter(username=username, domain=domain).exists() + ): raise forms.ValidationError(f"{username}@{domain} is already taken") def get_form(self): @@ -219,7 +223,7 @@ class Inbox(View): ): return HttpResponseBadRequest("Bad signature") # Hand off the item to be processed by the queue - Task.submit("inbox_item", subject=identity.actor_uri, payload=document) + InboxMessage.objects.create(message=document) return HttpResponse(status=202) |