Skip to content

Commit

Permalink
[FIX] Remove contact mananger always to support old servers (#27053)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman authored Oct 17, 2022
1 parent e28228d commit dd10fc3
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 dd10fc3

Please sign in to comment.