From 02b2e9b011239ccebcf3748d113585ae15b98e4e Mon Sep 17 00:00:00 2001 From: Vinit khandal <111434418+vinit717@users.noreply.github.com> Date: Wed, 18 Sep 2024 02:00:07 +0530 Subject: [PATCH] Revert "Dev to Main Sync" --- models/users.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/models/users.js b/models/users.js index 50d7daaf5..bc2d5dbfc 100644 --- a/models/users.js +++ b/models/users.js @@ -911,13 +911,7 @@ const updateUsernamesInBatch = async (usersData) => { }; usersData.forEach((user) => { - const updateUserData = { - ...user, - username: user.username, - first_name: user.first_name.toLowerCase(), - last_name: user.last_name.toLowerCase(), - }; - + const updateUserData = { ...user, username: user.username }; batch.update(userModel.doc(user.id), updateUserData); usersBatch.push(user.id); }); @@ -985,13 +979,9 @@ const updateUsersWithNewUsernames = async () => { const suffix = index + 1; const formattedUsername = formatUsername(user.userData.first_name, user.userData.last_name, suffix); - usersToUpdate.push({ - ...user.userData, - id: user.id, - username: formattedUsername, - first_name: user.userData.first_name.toLowerCase(), - last_name: user.userData.last_name.toLowerCase(), - }); + if (user.userData.username !== formattedUsername) { + usersToUpdate.push({ ...user.userData, id: user.id, username: formattedUsername }); + } }); }