Fix being unable to unset nicknames

Remove unwanted guild profile handler in cdn
Fix rights check for bio/avatars of your own user
This commit is contained in:
Madeline
2023-02-05 12:35:27 +11:00
parent e7e3c67a77
commit cc50ebf47b
3 changed files with 18 additions and 36 deletions
@@ -65,9 +65,19 @@ router.patch(
if ("nick" in body) {
permission.hasThrow("MANAGE_NICKNAMES");
if (!body.nick) {
delete body.nick;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore shut up
member.nick = null; // remove the nickname
}
}
if (("bio" in body || "avatar" in body) && member_id != "@me") {
if (
("bio" in body || "avatar" in body) &&
req.params.member_id != "@me"
) {
const rights = await getRights(req.user_id);
rights.hasThrow("MANAGE_USERS");
}