fixed name update process

This commit is contained in:
Miodec 2021-01-29 20:46:21 +00:00
parent 355517ac53
commit 616434f7a1
2 changed files with 4 additions and 4 deletions

View file

@ -150,7 +150,7 @@ exports.changeDisplayName = functions.https.onCall(
await db
.collection("users")
.doc(request.uid)
.update({ name: request.name });
.set({ name: request.name }, { merge: true });
await db.collection("takenNames").doc(request.name.toLowerCase()).set(
{
taken: true,

View file

@ -323,7 +323,7 @@ function getAccountDataAndInit() {
db_updateName(user.uid, user.displayName);
} else {
//invalid, get new
Notifications.add("Invalid name", 0);
// Notifications.add("Invalid name", 0);
let promptVal = null;
let cdnVal = undefined;
@ -340,10 +340,10 @@ function getAccountDataAndInit() {
name: promptVal,
});
if (cdnVal.data.status === 1) {
Notifications.add("Name updated", 1);
alert("Name updated", 1);
location.reload();
} else if (cdnVal.data.status < 0) {
Notifications.add(cdnVal.data.message, 0);
alert(cdnVal.data.message, 0);
}
}
}