From e1dcba9aba5e2354efa76b97e8469d5b2e7456f0 Mon Sep 17 00:00:00 2001 From: blueb Date: Mon, 4 Dec 2023 04:45:33 +0000 Subject: [PATCH] fix ignoring person._misskey_summary on updating remote profiles --- .../src/remote/activitypub/models/person.ts | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/packages/backend/src/remote/activitypub/models/person.ts b/packages/backend/src/remote/activitypub/models/person.ts index afd91e4e7f..cde7565517 100644 --- a/packages/backend/src/remote/activitypub/models/person.ts +++ b/packages/backend/src/remote/activitypub/models/person.ts @@ -276,26 +276,26 @@ export async function createPerson( followersCount !== undefined ? followersCount : person.followers && - typeof person.followers !== "string" && - isCollectionOrOrderedCollection(person.followers) - ? person.followers.totalItems - : undefined, + typeof person.followers !== "string" && + isCollectionOrOrderedCollection(person.followers) + ? person.followers.totalItems + : undefined, followingCount: followingCount !== undefined ? followingCount : person.following && - typeof person.following !== "string" && - isCollectionOrOrderedCollection(person.following) - ? person.following.totalItems - : undefined, + typeof person.following !== "string" && + isCollectionOrOrderedCollection(person.following) + ? person.following.totalItems + : undefined, notesCount: notesCount !== undefined ? notesCount : person.outbox && - typeof person.outbox !== "string" && - isCollectionOrOrderedCollection(person.outbox) - ? person.outbox.totalItems - : undefined, + typeof person.outbox !== "string" && + isCollectionOrOrderedCollection(person.outbox) + ? person.outbox.totalItems + : undefined, featured: person.featured ? getApId(person.featured) : undefined, uri: person.id, tags, @@ -315,8 +315,8 @@ export async function createPerson( description: person._misskey_summary ? truncate(person._misskey_summary, summaryLength) : person.summary - ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) - : null, + ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) + : null, url: url, fields, birthday: bday ? bday[0] : null, @@ -527,26 +527,26 @@ export async function updatePerson( followersCount !== undefined ? followersCount : person.followers && - typeof person.followers !== "string" && - isCollectionOrOrderedCollection(person.followers) - ? person.followers.totalItems - : undefined, + typeof person.followers !== "string" && + isCollectionOrOrderedCollection(person.followers) + ? person.followers.totalItems + : undefined, followingCount: followingCount !== undefined ? followingCount : person.following && - typeof person.following !== "string" && - isCollectionOrOrderedCollection(person.following) - ? person.following.totalItems - : undefined, + typeof person.following !== "string" && + isCollectionOrOrderedCollection(person.following) + ? person.following.totalItems + : undefined, notesCount: notesCount !== undefined ? notesCount : person.outbox && - typeof person.outbox !== "string" && - isCollectionOrOrderedCollection(person.outbox) - ? person.outbox.totalItems - : undefined, + typeof person.outbox !== "string" && + isCollectionOrOrderedCollection(person.outbox) + ? person.outbox.totalItems + : undefined, featured: person.featured, emojis: emojiNames, name: truncate(person.name, nameLength), @@ -590,9 +590,11 @@ export async function updatePerson( { url: url, fields, - description: person.summary - ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) - : null, + description: person._misskey_summary + ? truncate(person._misskey_summary, summaryLength) + : person.summary + ? htmlToMfm(truncate(person.summary, summaryLength), person.tag) + : null, birthday: bday ? bday[0] : null, location: person["vcard:Address"] || null, },