update other controllers to also use the getAuthorFallback method

This commit is contained in:
Siddharth Singh 2024-06-01 14:21:36 +05:30
parent 126e482e0d
commit d5135200e8
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

View file

@ -4,7 +4,7 @@ import { z } from 'zod';
import { type AppController } from '@/app.ts';
import { Conf } from '@/config.ts';
import { getAuthor, getFollowedPubkeys } from '@/queries.ts';
import { getAuthor, getAuthorFallback, getFollowedPubkeys } from '@/queries.ts';
import { booleanParamSchema, fileSchema } from '@/schema.ts';
import { Storages } from '@/storages.ts';
import { uploadFile } from '@/utils/upload.ts';
@ -79,7 +79,7 @@ const verifyCredentialsController: AppController = async (c) => {
const accountController: AppController = async (c) => {
const pubkey = c.req.param('pubkey');
const event = await getAuthor(pubkey);
const event = await getAuthorFallback(pubkey);
if (event) {
return c.json(await renderAccount(event));
} else {
@ -244,7 +244,7 @@ const updateCredentialsController: AppController = async (c) => {
return c.json(result.error, 422);
}
const author = await getAuthor(pubkey);
const author = await getAuthorFallback(pubkey);
const meta = author ? n.json().pipe(n.metadata()).catch({}).parse(author.content) : {};
const {

View file

@ -9,7 +9,7 @@ import { type AppController } from '@/app.ts';
import { Conf } from '@/config.ts';
import { DittoDB } from '@/db/DittoDB.ts';
import { getUnattachedMediaByIds } from '@/db/unattached-media.ts';
import { getAncestors, getAuthor, getDescendants, getEvent } from '@/queries.ts';
import { getAncestors, getAuthorFallback, getDescendants, getEvent } from '@/queries.ts';
import { renderEventAccounts } from '@/views.ts';
import { renderReblog, renderStatus } from '@/views/mastodon/statuses.ts';
import { Storages } from '@/storages.ts';
@ -163,7 +163,7 @@ const createStatusController: AppController = async (c) => {
tags,
}, c);
const author = await getAuthor(event.pubkey);
const author = await getAuthorFallback(event.pubkey);
if (data.quote_id) {
await hydrateEvents({
@ -189,7 +189,7 @@ const deleteStatusController: AppController = async (c) => {
tags: [['e', id]],
}, c);
const author = await getAuthor(event.pubkey);
const author = await getAuthorFallback(event.pubkey);
return c.json(await renderStatus({ ...event, author }, { viewerPubkey: pubkey }));
} else {
return c.json({ error: 'Unauthorized' }, 403);