From 1a0b4b57030d95cc327e94f3cae79627868ef7d7 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Fri, 15 Jul 2022 21:38:11 +0100 Subject: [PATCH] feat: render masquerade colour --- src/components/common/user/UserShort.tsx | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/components/common/user/UserShort.tsx b/src/components/common/user/UserShort.tsx index 3f480b89..b2ca22b2 100644 --- a/src/components/common/user/UserShort.tsx +++ b/src/components/common/user/UserShort.tsx @@ -55,7 +55,7 @@ export const Username = observer( ...otherProps }: UsernameProps) => { let username = user?.username; - let color; + let color = masquerade?.colour; if (user && showServerIdentity) { const { server } = useParams<{ server?: string }>(); @@ -75,20 +75,10 @@ export const Username = observer( } } - const role = member.hoistedRole; - if (role) { - color = role[1].colour; - } - - if (member.roles && member.roles.length > 0) { - const srv = client.servers.get(member._id.server); - if (srv?.roles) { - for (const role of member.roles) { - const c = srv.roles[role]?.colour; - if (c) { - color = c; - continue; - } + if (!color) { + for (const [_, { colour }] of member.orderedRoles) { + if (colour) { + color = colour; } } }