From e1fd192f8b252dbf46c20810e73768c6145af475 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Thu, 10 Aug 2023 12:31:23 +0100 Subject: [PATCH] chore: unset display name --- components/pages/inspector/UserActions.tsx | 2 +- lib/actions.ts | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/components/pages/inspector/UserActions.tsx b/components/pages/inspector/UserActions.tsx index 9d35ff1..2b7da86 100644 --- a/components/pages/inspector/UserActions.tsx +++ b/components/pages/inspector/UserActions.tsx @@ -84,7 +84,7 @@ export function UserActions({ user, bot }: { user: User; bot?: Bot }) { const badges = (decodeTime(user._id) < 1629638578431 ? 256 : 0) | ((userDraft.badges ?? 0) ^ badge); - const result = await updateUserBadges(user._id, badges); + await updateUserBadges(user._id, badges); setUserDraft((user) => ({ ...user!, badges })); toast({ title: "Updated user badges", diff --git a/lib/actions.ts b/lib/actions.ts index 9756845..ddc733d 100644 --- a/lib/actions.ts +++ b/lib/actions.ts @@ -473,8 +473,6 @@ export async function wipeUserProfile( ) { await checkPermission("users/action/wipe-profile", userId); - const newDisplayName = (await fetchUserById(userId))?.username || "--"; - await mongo() .db("revolt") .collection("users") @@ -488,14 +486,8 @@ export async function wipeUserProfile( ...(fields.bio ? { "profile.content": 1 } : {}), ...(fields.status ? { "status.text": 1 } : {}), ...(fields.avatar ? { avatar: 1 } : {}), + ...(fields.displayName ? { display_name: 1 } : {}), }, - ...(fields.displayName - ? { - $set: { - display_name: newDisplayName, - }, - } - : {}), } ); }