From 9d4f74d29014c608e977a2acc9e3b636986b7d3c Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 5 Nov 2023 14:49:44 +0100 Subject: [PATCH] [backend] Add _misskey_summary field This fixes federation of MFM in user bios between *key instances Co-authored-by: default avatarkakkokari-gtyih ref: https://github.com/misskey-dev/misskey/pull/12184 --- packages/backend/src/remote/activitypub/models/person.ts | 8 +++++--- packages/backend/src/remote/activitypub/renderer/index.ts | 1 + .../backend/src/remote/activitypub/renderer/person.ts | 1 + packages/backend/src/remote/activitypub/type.ts | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index 84907558b..59b0dad69 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -604,9 +604,11 @@ export async function updatePerson( { url: url, fields, - description: person.summary - ? await htmlToMfm(truncate(person.summary, summaryLength), person.tag) - : null, + description: person._misskey_summary + ? truncate(person._misskey_summary, summaryLength) + : person.summary + ? await htmlToMfm(truncate(person.summary, summaryLength), person.tag) + : null, birthday: bday ? bday[0] : null, location: person["vcard:Address"] || null, }, diff --git a/packages/backend/src/remote/activitypub/renderer/index.ts b/packages/backend/src/remote/activitypub/renderer/index.ts index 7b98cf2d7..a688b1194 100644 --- a/packages/backend/src/remote/activitypub/renderer/index.ts +++ b/packages/backend/src/remote/activitypub/renderer/index.ts @@ -41,6 +41,7 @@ export const renderActivity = (x: any): IActivity | null => { _misskey_reaction: "misskey:_misskey_reaction", _misskey_votes: "misskey:_misskey_votes", _misskey_talk: "misskey:_misskey_talk", + _misskey_summary: "misskey:_misskey_summary", isCat: "misskey:isCat", // Fedibird fedibird: "http://fedibird.com/ns#", diff --git a/packages/backend/src/remote/activitypub/renderer/person.ts b/packages/backend/src/remote/activitypub/renderer/person.ts index 7046ab066..a40269bcb 100644 --- a/packages/backend/src/remote/activitypub/renderer/person.ts +++ b/packages/backend/src/remote/activitypub/renderer/person.ts @@ -75,6 +75,7 @@ export async function renderPerson(user: ILocalUser) { summary: profile.description ? await toHtml(mfm.parse(profile.description), profile.mentions, profile.userHost) : null, + _misskey_summary: profile.description, icon: avatar ? renderImage(avatar) : null, image: banner ? renderImage(banner) : null, tag, diff --git a/packages/backend/src/remote/activitypub/type.ts b/packages/backend/src/remote/activitypub/type.ts index 45002ef60..7b54b2320 100644 --- a/packages/backend/src/remote/activitypub/type.ts +++ b/packages/backend/src/remote/activitypub/type.ts @@ -206,6 +206,7 @@ export interface IActor extends IObject { }; "vcard:bday"?: string; "vcard:Address"?: string; + _misskey_summary?: string; } export const isCollection = (object: IObject): object is ICollection =>