Fix account relationships

This commit is contained in:
Alex Gleason
2023-06-20 16:02:43 -05:00
parent 4258d4b27f
commit 3000f94325
2 changed files with 7 additions and 14 deletions

View File

@ -136,8 +136,12 @@ const transformAccount = <T extends TransformableAccount>({ 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,

View File

@ -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);
// });
});
};