From a847e4d5cc50371bace0aed49d780a6df968c094 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 25 Sep 2023 21:10:49 +0200 Subject: [PATCH] upd: move patch function and make note user always detail --- .../backend/src/core/entities/NoteEntityService.ts | 2 +- .../server/api/mastodon/MastodonApiServerService.ts | 4 ++-- .../src/server/api/mastodon/endpoints/account.ts | 11 ----------- packages/megalodon/src/misskey/entities/note.ts | 2 +- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index 7b54ce5c6d..f4725d8d46 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -310,7 +310,7 @@ export class NoteEntityService implements OnModuleInit { createdAt: note.createdAt.toISOString(), userId: note.userId, user: this.userEntityService.pack(note.user ?? note.userId, me, { - detail: false, + detail: true, }), text: text, cw: note.cw, diff --git a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts index 3f1af0cf5f..08976db2b0 100644 --- a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts +++ b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts @@ -242,8 +242,8 @@ export class MastodonApiServerService { const client = getClient(BASE_URL, accessTokens); // we are using this here, because in private mode some info isnt // displayed without being logged in try { - const account = new ApiAccountMastodon(_request, client, BASE_URL); - reply.send(await account.updateCredentials()); + const data = await client.updateCredentials(_request.body!); + reply.send(convertAccount(data.data)); } catch (e: any) { /* console.error(e); */ reply.code(401).send(e.response.data); diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts index b9e9cb862f..4abb5fff19 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/account.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts @@ -58,17 +58,6 @@ export class ApiAccountMastodon { } } - public async updateCredentials() { - try { - const data = await this.client.updateCredentials(this.request.body as any); - return convertAccount(data.data); - } catch (e: any) { - /* console.error(e); - console.error(e.response.data); */ - return e.response; - } - } - public async lookup() { try { const data = await this.client.search((this.request.query as any).acct, { type: 'accounts' }); diff --git a/packages/megalodon/src/misskey/entities/note.ts b/packages/megalodon/src/misskey/entities/note.ts index 08c5f10aea..ef5f19d0ab 100644 --- a/packages/megalodon/src/misskey/entities/note.ts +++ b/packages/megalodon/src/misskey/entities/note.ts @@ -8,7 +8,7 @@ namespace MisskeyEntity { id: string createdAt: string userId: string - user: User + user: UserDetail text: string | null cw: string | null visibility: 'public' | 'home' | 'followers' | 'specified'