Sync the user on verify_credentials

Fixes https://gitlab.com/soapbox-pub/ditto/-/issues/11
This commit is contained in:
Alex Gleason
2023-08-19 13:57:17 -05:00
parent c08c801e71
commit eb4aebedd7
2 changed files with 22 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ import { type AppController } from '@/app.ts';
import { type Filter, findReplyTag, z } from '@/deps.ts';
import * as mixer from '@/mixer.ts';
import * as pipeline from '@/pipeline.ts';
import { getAuthor, getFollows } from '@/queries.ts';
import { getAuthor, getFollows, syncUser } from '@/queries.ts';
import { booleanParamSchema } from '@/schema.ts';
import { jsonMetaContentSchema } from '@/schemas/nostr.ts';
import { signEvent } from '@/sign.ts';
@@ -25,6 +25,8 @@ const createAccountController: AppController = (c) => {
const verifyCredentialsController: AppController = async (c) => {
const pubkey = c.get('pubkey')!;
await syncUser(pubkey);
const event = await getAuthor(pubkey);
if (event) {
return c.json(await toAccount(event, { withSource: true }));