enhance(federation/profile): 相互リンクのテキストが連合するように (MisskeyIO#705)

This commit is contained in:
すてさん 2024-08-17 07:05:10 +09:00 committed by GitHub
parent f11d0461d7
commit 08fcb3b3fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -466,7 +466,7 @@ export class ApRendererService {
this.userProfilesRepository.findOneByOrFail({ userId: user.id }),
]);
const attachment = profile.fields.map(field => ({
const profileFields = profile.fields.map(field => ({
type: 'PropertyValue',
name: field.name,
value: (field.value.startsWith('http://') || field.value.startsWith('https://'))
@ -474,6 +474,16 @@ export class ApRendererService {
: field.value,
}));
const mutualLinks = profile.mutualLinkSections.flatMap(section =>
section.mutualLinks.map(link => ({
type: 'PropertyValue',
name: section.name ?? link.description ?? 'Link',
value: `<a href="${link.url}" target="_blank">${link.description ?? link.url}</a>`,
})),
);
const attachment = mutualLinks.concat(profileFields);
const emojis = await this.getEmojis(user.emojis);
const apemojis = emojis.filter(emoji => !emoji.localOnly).map(emoji => this.renderEmoji(emoji));