From 4fa6b96d15cfc88f37a85a8990c82db2dd88eb49 Mon Sep 17 00:00:00 2001 From: "P. Reis" Date: Thu, 9 May 2024 13:44:05 -0300 Subject: [PATCH] refactor(admin action): mute account even if it doesn't have a kind 0 --- src/controllers/api/admin.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/controllers/api/admin.ts b/src/controllers/api/admin.ts index 97e28b4e..99a8e5bc 100644 --- a/src/controllers/api/admin.ts +++ b/src/controllers/api/admin.ts @@ -66,8 +66,6 @@ const adminAccountAction: AppController = async (c) => { const body = await parseBody(c.req.raw); const result = adminAccountActionSchema.safeParse(body); const authorId = c.req.param('id'); - const store = c.get('store'); - const { signal } = c.req.raw; if (!result.success) { return c.json({ error: 'This action is not allowed' }, 403); @@ -79,14 +77,9 @@ const adminAccountAction: AppController = async (c) => { return c.json({ error: 'Record invalid' }, 422); } - const [event] = await store.query([{ kinds: [0], authors: [authorId], limit: 1 }], { signal }); - if (!event) { - return c.json({ error: 'Record not found' }, 404); - } - await updateListAdminEvent( { kinds: [10000], authors: [Conf.pubkey] }, - (tags) => addTag(tags, ['p', event.pubkey]), + (tags) => addTag(tags, ['p', authorId]), c, );