From 51fdf1c0a9331fb7326720682f5c185db7c5764d Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Mon, 17 Oct 2022 08:44:07 -0700 Subject: [PATCH] [FIX] Remove contact mananger always to support old servers (#27053) --- apps/meteor/app/lib/server/functions/deleteUser.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/meteor/app/lib/server/functions/deleteUser.ts b/apps/meteor/app/lib/server/functions/deleteUser.ts index d80bfe7ad5d63..ddd9aa0a81991 100644 --- a/apps/meteor/app/lib/server/functions/deleteUser.ts +++ b/apps/meteor/app/lib/server/functions/deleteUser.ts @@ -65,15 +65,17 @@ export async function deleteUser(userId: string, confirmRelinquish = false): Pro if (user.roles.includes('livechat-agent')) { // Remove user as livechat agent LivechatDepartmentAgents.removeByAgentId(userId); - await LivechatVisitors.removeContactManagerByUsername(user.username); } if (user.roles.includes('livechat-monitor')) { // Remove user as Unit Monitor LivechatUnitMonitors.removeByMonitorId(userId); - await LivechatVisitors.removeContactManagerByUsername(user.username); } + // This is for compatibility. Since we allowed any user to be contact manager b4, we need to have the same logic + // for deletion. + await LivechatVisitors.removeContactManagerByUsername(user.username); + // removes user's avatar if (user.avatarOrigin === 'upload' || user.avatarOrigin === 'url' || user.avatarOrigin === 'rest') { FileUpload.getStore('Avatars').deleteByName(user.username);