From ce1efd3955b801f0ea69f7b286248467f2c9e6f2 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 22 Nov 2024 12:16:46 -0500 Subject: [PATCH] fix: hotfix for empty user fields --- src/activitypub/mocks.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js index e255757c54..9446302202 100644 --- a/src/activitypub/mocks.js +++ b/src/activitypub/mocks.js @@ -69,9 +69,10 @@ Mocks.profile = async (actors, hostMap) => { bgColor = iconBackgrounds[bgColor % iconBackgrounds.length]; // Add custom fields into user hash - const customFields = actor.attachment + const customFields = actor.attachment ? actor.attachment .filter(attachment => attachment.type === 'PropertyValue') - .reduce((map, { name, value }) => map.set(name, value), new Map()); + .reduce((map, { name, value }) => map.set(name, value), new Map()) : + undefined; const payload = { uid, @@ -95,7 +96,7 @@ Mocks.profile = async (actors, hostMap) => { inbox, sharedInbox: endpoints ? endpoints.sharedInbox : null, followersUrl: followers, - customFields: new URLSearchParams(customFields).toString(), + customFields: customFields && new URLSearchParams(customFields).toString(), }; return payload;