From 981165ae8bf8d416e08ca66d86765b7bae8e0f4c Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Sun, 29 Oct 2023 13:37:01 -0700 Subject: [PATCH] feat: :sparkles: Support for _misskey_summary Co-authored-by: kakkokari-gtyih ref: https://github.com/misskey-dev/misskey/pull/12184 --- packages/backend/src/remote/activitypub/models/person.ts | 4 +++- packages/backend/src/remote/activitypub/renderer/index.ts | 1 + packages/backend/src/remote/activitypub/renderer/person.ts | 1 + packages/backend/src/remote/activitypub/type.ts | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index ab017b65ac..b13ee23e89 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -313,7 +313,9 @@ export async function createPerson( await transactionalEntityManager.save( new UserProfile({ userId: user.id, - description: person.summary + description: person._misskey_summary + ? truncate(person._misskey_summary, summaryLength) + : person.summary ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) : null, url: url, diff --git a/packages/backend/src/remote/activitypub/renderer/index.ts b/packages/backend/src/remote/activitypub/renderer/index.ts index 7d2eb95288..c60a1f4cdb 100644 --- a/packages/backend/src/remote/activitypub/renderer/index.ts +++ b/packages/backend/src/remote/activitypub/renderer/index.ts @@ -43,6 +43,7 @@ export const renderActivity = (x: any): IActivity | null => { _misskey_talk: "misskey:_misskey_talk", _misskey_reaction: "misskey:_misskey_reaction", _misskey_votes: "misskey:_misskey_votes", + _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 9f642bb9e5..db176a0dde 100644 --- a/packages/backend/src/remote/activitypub/renderer/person.ts +++ b/packages/backend/src/remote/activitypub/renderer/person.ts @@ -74,6 +74,7 @@ export async function renderPerson(user: ILocalUser) { summary: profile.description ? toHtml(mfm.parse(profile.description)) : 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 0e63f3ed55..cf0410767b 100644 --- a/packages/backend/src/remote/activitypub/type.ts +++ b/packages/backend/src/remote/activitypub/type.ts @@ -205,6 +205,7 @@ export interface IActor extends IObject { }; "vcard:bday"?: string; "vcard:Address"?: string; + _misskey_summary?: string; } export const isCollection = (object: IObject): object is ICollection =>