Apply 2 suggestion(s) to 1 file(s)

This commit is contained in:
Alex Gleason 2024-04-09 22:08:37 +00:00
parent 7e8401688c
commit a63dc8be4e
1 changed files with 2 additions and 3 deletions

View File

@ -229,8 +229,7 @@ const reblogStatusController: AppController = async (c) => {
/** https://docs.joinmastodon.org/methods/statuses/#unreblog */ /** https://docs.joinmastodon.org/methods/statuses/#unreblog */
const unreblogStatusController: AppController = async (c) => { const unreblogStatusController: AppController = async (c) => {
const eventId = c.req.param('id'); const eventId = c.req.param('id');
const pubkey = c.get('pubkey'); const pubkey = c.get('pubkey')!;
if (!pubkey) return c.json({ error: 'Unauthorized' }, 403);
const event = await getEvent(eventId, { const event = await getEvent(eventId, {
kind: 1, kind: 1,
@ -238,7 +237,7 @@ const unreblogStatusController: AppController = async (c) => {
if (!event) return c.json({ error: 'Event not found.' }, 404); if (!event) return c.json({ error: 'Event not found.' }, 404);
const filters: NostrFilter[] = [{ kinds: [6], authors: [pubkey], '#e': [event.id] }]; const filters: NostrFilter[] = [{ kinds: [6], authors: [pubkey], '#e': [event.id] }];
const repostedEvent = (await eventsDB.query(filters, { limit: 1 }))[0]; const [repostedEvent] = await eventsDB.query(filters, { limit: 1 });
if (!repostedEvent) return c.json({ error: 'Event not found.' }, 404); if (!repostedEvent) return c.json({ error: 'Event not found.' }, 404);
await createEvent({ await createEvent({