Fix role badges for Pleroma
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
b47b1666e7
commit
aace58ccb4
1 changed files with 2 additions and 2 deletions
|
@ -129,7 +129,7 @@ const getDomain = (url: string) => {
|
|||
};
|
||||
|
||||
const filterBadges = (tags?: string[]) =>
|
||||
tags?.filter(tag => tag.startsWith('badge:')).map(tag => ({ id: tag, name: tag.replace(/^badge:/, '') }));
|
||||
tags?.filter(tag => tag.startsWith('badge:')).map(tag => roleSchema.parse({ id: tag, name: tag.replace(/^badge:/, '') }));
|
||||
|
||||
/** Add internal fields to the account. */
|
||||
const transformAccount = <T extends TransformableAccount>({ pleroma, other_settings, fields, ...account }: T) => {
|
||||
|
@ -169,7 +169,7 @@ const transformAccount = <T extends TransformableAccount>({ pleroma, other_setti
|
|||
const { relationship, ...rest } = pleroma;
|
||||
return rest;
|
||||
})(),
|
||||
roles: account.roles || filterBadges(pleroma?.tags),
|
||||
roles: account.roles.length ? account.roles : filterBadges(pleroma?.tags),
|
||||
relationship: pleroma?.relationship,
|
||||
staff: pleroma?.is_admin || pleroma?.is_moderator || false,
|
||||
suspended: account.suspended || pleroma?.deactivated || false,
|
||||
|
|
Loading…
Reference in a new issue