From 4c079f2516eeaeb52f7156274fd20e8cef7899f2 Mon Sep 17 00:00:00 2001 From: Miodec Date: Sat, 1 Jul 2023 11:18:28 +0200 Subject: [PATCH] flagging user for name change if their name is nullish --- backend/src/api/controllers/user.ts | 5 +++++ frontend/src/ts/controllers/account-controller.ts | 2 +- frontend/src/ts/popups/simple-popups.ts | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/src/api/controllers/user.ts b/backend/src/api/controllers/user.ts index 365989eba..947bc0559 100644 --- a/backend/src/api/controllers/user.ts +++ b/backend/src/api/controllers/user.ts @@ -360,6 +360,11 @@ export async function getUser( inboxUnreadSize = _.filter(userInfo.inbox, { read: false }).length; } + if (!userInfo.name) { + userInfo.needsToChangeName = true; + UserDAL.flagForNameChange(uid); + } + const userData = { ...getRelevantUserInfo(userInfo), inboxUnreadSize: inboxUnreadSize, diff --git a/frontend/src/ts/controllers/account-controller.ts b/frontend/src/ts/controllers/account-controller.ts index 0970bf83c..91d8ebade 100644 --- a/frontend/src/ts/controllers/account-controller.ts +++ b/frontend/src/ts/controllers/account-controller.ts @@ -144,7 +144,7 @@ export async function getDataAndInit(): Promise { if (snapshot.needsToChangeName) { Notifications.addBanner( - "Your name was reset. Click here to change it and learn more about why.", + "You need to update your account name. Click here to change it and learn more about why.", -1, undefined, true, diff --git a/frontend/src/ts/popups/simple-popups.ts b/frontend/src/ts/popups/simple-popups.ts index 0568146ae..dbdd3fd3b 100644 --- a/frontend/src/ts/popups/simple-popups.ts +++ b/frontend/src/ts/popups/simple-popups.ts @@ -470,7 +470,7 @@ list["updateName"] = new SimplePopup( if (snapshot.needsToChangeName) { setTimeout(() => { location.reload(); - }, 3000); + }, 1000); } } catch (e) { const typedError = e as FirebaseError; @@ -492,7 +492,7 @@ list["updateName"] = new SimplePopup( } if (snapshot.needsToChangeName === true) { thisPopup.text = - "We've recently identified several issues that allowed users to register with names that were already taken. Accounts which signed up earliest get to keep the duplicated name, and others are forced to change. Unique names are essential for smooth operation of upcoming features like public profiles, multiplayer, and more. Sorry for the inconvenience."; + "You need to change your account name. This might be because you have a duplicate name, no account name or your name is not allowed. Sorry for the inconvenience."; } }, (_thisPopup) => {