From a003fb27078f2a863c33d05c1a8e0b24bdb0e8fe Mon Sep 17 00:00:00 2001 From: okayurisotto Date: Mon, 3 Jul 2023 06:49:02 +0900 Subject: [PATCH] =?UTF-8?q?refactor(`ApPersonService.ts`):=20=E5=86=97?= =?UTF-8?q?=E9=95=B7=E3=81=A0=E3=81=A3=E3=81=9F=E9=83=A8=E5=88=86=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/core/activitypub/models/ApPersonService.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index e1322bb260..c769d16b9e 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -243,7 +243,7 @@ export class ApPersonService implements OnModuleInit { const host = this.punyHost(object.id); - const { fields } = this.analyzeAttachments(person.attachment ?? []); + const fields = this.analyzeAttachments(person.attachment ?? []); const tags = extractApHashtags(person.tag).map(normalizeForSearch).splice(0, 32); @@ -444,7 +444,7 @@ export class ApPersonService implements OnModuleInit { const emojiNames = emojis.map(emoji => emoji.name); - const { fields } = this.analyzeAttachments(person.attachment ?? []); + const fields = this.analyzeAttachments(person.attachment ?? []); const tags = extractApHashtags(person.tag).map(tag => normalizeForSearch(tag)).splice(0, 32); @@ -577,8 +577,8 @@ export class ApPersonService implements OnModuleInit { } @bindThis - // TODO: `attachments`が`IObject`だった場合、返り値が`{ fields: [] }`になるようだが構わないのか? - public analyzeAttachments(attachments: IObject | IObject[] | undefined): { fields: Field[] } { + // TODO: `attachments`が`IObject`だった場合、返り値が`[]`になるようだが構わないのか? + public analyzeAttachments(attachments: IObject | IObject[] | undefined): Field[] { const fields: Field[] = []; if (Array.isArray(attachments)) { @@ -590,7 +590,7 @@ export class ApPersonService implements OnModuleInit { } } - return { fields }; + return fields; } @bindThis