Fix role ordering (#789)

* fix role order in picker

* one of these sorts will flip it omg

* fix role list

* revert forced role sort in api
This commit is contained in:
41666 2023-05-28 11:15:44 -04:00 committed by GitHub
parent 33a8a0048f
commit 45a1f45055
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 18 deletions

View file

@ -47,18 +47,15 @@ export const getGuild = async (
.filter((x) => x !== undefined) as APIRole[]
)?.position || -1;
const roles = guildRaw.roles
.map<Role>((role) => ({
id: role.id,
name: role.name,
color: role.color,
managed: role.managed,
position: role.position,
permissions: role.permissions,
safety: calculateRoleSafety(role, highestRolePosition),
}))
// sort so that highest is first
.sort((a, b) => b.position - a.position);
const roles = guildRaw.roles.map<Role>((role) => ({
id: role.id,
name: role.name,
color: role.color,
managed: role.managed,
position: role.position,
permissions: role.permissions,
safety: calculateRoleSafety(role, highestRolePosition),
}));
const guild: Guild & OwnRoleInfo = {
id,