From 3000f9432503a62403eac2b676e135f21bc7c368 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 20 Jun 2023 16:02:43 -0500 Subject: [PATCH] Fix account relationships --- app/soapbox/schemas/account.ts | 8 ++++++-- app/soapbox/selectors/index.ts | 13 +------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/app/soapbox/schemas/account.ts b/app/soapbox/schemas/account.ts index c588070b1..b1e35fc66 100644 --- a/app/soapbox/schemas/account.ts +++ b/app/soapbox/schemas/account.ts @@ -136,8 +136,12 @@ const transformAccount = ({ pleroma, other_setti moderator: pleroma?.is_moderator || false, location: account.location || pleroma?.location || other_settings?.location || '', note_emojified: emojify(account.note, customEmojiMap), - pleroma, - relationship: relationshipSchema.parse({ id: account.id, ...pleroma?.relationship }), + pleroma: (() => { + if (!pleroma) return undefined; + const { relationship, ...rest } = pleroma; + return rest; + })(), + relationship: pleroma?.relationship, staff: pleroma?.is_admin || pleroma?.is_moderator || false, suspended: account.suspended || pleroma?.deactivated || false, verified: account.verified || pleroma?.tags.includes('verified') || false, diff --git a/app/soapbox/selectors/index.ts b/app/soapbox/selectors/index.ts index 190c18834..4ffc8afba 100644 --- a/app/soapbox/selectors/index.ts +++ b/app/soapbox/selectors/index.ts @@ -43,19 +43,8 @@ export const makeGetAccount = () => { getAccountPatron, ], (base, counters, relationship, moved, meta, admin, patron) => { if (!base) return null; - + base.relationship = base.relationship ?? relationship; return base; - // return base.withMutations(map => { - // if (counters) map.merge(counters); - // if (meta) { - // map.merge(meta); - // map.set('pleroma', meta.pleroma.merge(base.get('pleroma') || ImmutableMap())); // Lol, thanks Pleroma - // } - // if (relationship) map.set('relationship', relationship); - // map.set('moved', moved || null); - // map.set('patron', patron || null); - // map.setIn(['pleroma', 'admin'], admin); - // }); }); };