fix(backend): プロフィールの自己紹介欄のMFMを連合するように (misskey-dev#12184) (MisskeyIO#199)

Co-authored-by: kakkokari-gtyih <daisho7308+f@gmail.com>
This commit is contained in:
まっちゃとーにゅ 2023-10-30 00:42:11 +09:00 committed by GitHub
parent 462b5470b7
commit 5bcf8e9b9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View file

@ -496,6 +496,7 @@ export class ApRendererService {
preferredUsername: user.username, preferredUsername: user.username,
name: user.name, name: user.name,
summary: profile.description ? this.mfmService.toHtml(mfm.parse(profile.description)) : null, summary: profile.description ? this.mfmService.toHtml(mfm.parse(profile.description)) : null,
_misskey_summary: profile.description,
icon: avatar ? this.renderImage(avatar) : null, icon: avatar ? this.renderImage(avatar) : null,
image: banner ? this.renderImage(banner) : null, image: banner ? this.renderImage(banner) : null,
tag, tag,
@ -645,6 +646,7 @@ export class ApRendererService {
'_misskey_quote': 'misskey:_misskey_quote', '_misskey_quote': 'misskey:_misskey_quote',
'_misskey_reaction': 'misskey:_misskey_reaction', '_misskey_reaction': 'misskey:_misskey_reaction',
'_misskey_votes': 'misskey:_misskey_votes', '_misskey_votes': 'misskey:_misskey_votes',
'_misskey_summary': 'misskey:_misskey_summary',
'isCat': 'misskey:isCat', 'isCat': 'misskey:isCat',
// vcard // vcard
vcard: 'http://www.w3.org/2006/vcard/ns#', vcard: 'http://www.w3.org/2006/vcard/ns#',

View file

@ -335,9 +335,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.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,
@ -503,10 +511,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,
}); });

View file

@ -12,6 +12,7 @@ export interface IObject {
id?: string; id?: string;
name?: string | null; name?: string | null;
summary?: string; summary?: string;
_misskey_summary?: string;
published?: string; published?: string;
cc?: ApObject; cc?: ApObject;
to?: ApObject; to?: ApObject;