fix(backend): プロフィールの自己紹介欄のMFMを連合するように(実装漏れ) (#12185)

* (refactor) eliminate nested ternary operation

* fix lint

* Jissou more
This commit is contained in:
かっこかり 2023-10-30 08:20:32 +09:00 committed by GitHub
parent 2de4d3329d
commit 117db08880
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -319,9 +319,17 @@ export class ApPersonService implements OnModuleInit {
emojis, emojis,
})) as MiRemoteUser; })) 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({ await transactionalEntityManager.save(new MiUserProfile({
userId: user.id, 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, url,
fields, fields,
birthday: bday?.[0] ?? null, 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 }, { await this.userProfilesRepository.update({ userId: exist.id }, {
url, url,
fields, fields,
description: person.summary ? this.apMfmService.htmlToMfm(truncate(person.summary, summaryLength), person.tag) : null, description: _description,
birthday: bday?.[0] ?? null, birthday: bday?.[0] ?? null,
location: person['vcard:Address'] ?? null, location: person['vcard:Address'] ?? null,
}); });