From 117db08880f728efd469a726bea7f8f00e74b2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Mon, 30 Oct 2023 08:20:32 +0900 Subject: [PATCH] =?UTF-8?q?fix(backend):=20=E3=83=97=E3=83=AD=E3=83=95?= =?UTF-8?q?=E3=82=A3=E3=83=BC=E3=83=AB=E3=81=AE=E8=87=AA=E5=B7=B1=E7=B4=B9?= =?UTF-8?q?=E4=BB=8B=E6=AC=84=E3=81=AEMFM=E3=82=92=E9=80=A3=E5=90=88?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=EF=BC=88=E5=AE=9F?= =?UTF-8?q?=E8=A3=85=E6=BC=8F=E3=82=8C=EF=BC=89=20(#12185)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * (refactor) eliminate nested ternary operation * fix lint * Jissou more --- .../activitypub/models/ApPersonService.ts | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index 7164feec9..d6a7de060 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -319,9 +319,17 @@ export class ApPersonService implements OnModuleInit { emojis, })) as MiRemoteUser; + let _description: string | null = null; + + if (person._misskey_summary) { + _description = truncate(person._misskey_summary, summaryLength); + } else if (person.summary) { + _description = this.apMfmService.htmlToMfm(truncate(person.summary, summaryLength), person.tag); + } + await transactionalEntityManager.save(new MiUserProfile({ userId: user.id, - description: person._misskey_summary ? truncate(person._misskey_summary, summaryLength) : person.summary ? this.apMfmService.htmlToMfm(truncate(person.summary, summaryLength), person.tag) : null, + description: _description, url, fields, birthday: bday?.[0] ?? null, @@ -487,10 +495,18 @@ export class ApPersonService implements OnModuleInit { }); } + let _description: string | null = null; + + if (person._misskey_summary) { + _description = truncate(person._misskey_summary, summaryLength); + } else if (person.summary) { + _description = this.apMfmService.htmlToMfm(truncate(person.summary, summaryLength), person.tag); + } + await this.userProfilesRepository.update({ userId: exist.id }, { url, fields, - description: person.summary ? this.apMfmService.htmlToMfm(truncate(person.summary, summaryLength), person.tag) : null, + description: _description, birthday: bday?.[0] ?? null, location: person['vcard:Address'] ?? null, });