summaryrefslogtreecommitdiffstats
path: root/miniq
diff options
context:
space:
mode:
Diffstat (limited to 'miniq')
-rw-r--r--miniq/migrations/0001_initial.py9
-rw-r--r--miniq/views.py7
2 files changed, 12 insertions, 4 deletions
diff --git a/miniq/migrations/0001_initial.py b/miniq/migrations/0001_initial.py
index 6775ff3..32c5d53 100644
--- a/miniq/migrations/0001_initial.py
+++ b/miniq/migrations/0001_initial.py
@@ -1,4 +1,4 @@
-# Generated by Django 4.1.3 on 2022-11-06 03:59
+# Generated by Django 4.1.3 on 2022-11-06 19:58
from django.db import migrations, models
@@ -22,7 +22,12 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
- ("type", models.CharField(max_length=500)),
+ (
+ "type",
+ models.CharField(
+ choices=[("identity_fetch", "Identity Fetch")], max_length=500
+ ),
+ ),
("priority", models.IntegerField(default=0)),
("subject", models.TextField()),
("payload", models.JSONField(blank=True, null=True)),
diff --git a/miniq/views.py b/miniq/views.py
index 12da7cd..21275f8 100644
--- a/miniq/views.py
+++ b/miniq/views.py
@@ -64,5 +64,8 @@ class QueueProcessor(View):
await task.fail(f"{e}\n\n" + traceback.format_exc())
async def handle_identity_fetch(self, subject, payload):
- identity = await sync_to_async(Identity.by_handle)(subject)
- await identity.fetch_details()
+ # Get the actor URI via webfinger
+ actor_uri, handle = await Identity.fetch_webfinger(subject)
+ # Get or create the identity, then fetch
+ identity = await sync_to_async(Identity.by_actor_uri)(actor_uri, create=True)
+ await identity.fetch_actor()