Skip to content

Commit

Permalink
Remove contact mananger always to support old servers
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman committed Oct 11, 2022
1 parent ff732f9 commit 6e4610f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/meteor/app/lib/server/functions/deleteUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6e4610f

Please sign in to comment.