Skip to content

Commit

Permalink
removeDepartment
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman committed Oct 16, 2023
1 parent 33e1bea commit 5a8f429
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions apps/meteor/app/livechat/server/lib/Livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
Subscriptions,
Messages,
LivechatDepartment as LivechatDepartmentRaw,
LivechatDepartmentAgents,
Rooms,
Users,
ReadReceipts,
Expand Down Expand Up @@ -568,41 +567,6 @@ export const Livechat = {
return updateDepartmentAgents(_id, departmentAgents, department.enabled);
},

/*
* @deprecated - Use the equivalent from DepartmentHelpers class
*/
async removeDepartment(_id) {
check(_id, String);

const departmentRemovalEnabled = settings.get('Omnichannel_enable_department_removal');

if (!departmentRemovalEnabled) {
throw new Meteor.Error('department-removal-disabled', 'Department removal is disabled', {
method: 'livechat:removeDepartment',
});
}

const department = await LivechatDepartmentRaw.findOneById(_id, { projection: { _id: 1 } });

if (!department) {
throw new Meteor.Error('department-not-found', 'Department not found', {
method: 'livechat:removeDepartment',
});
}
const ret = (await LivechatDepartmentRaw.removeById(_id)).deletedCount;
const agentsIds = (await LivechatDepartmentAgents.findByDepartmentId(_id, { projection: { agentId: 1 } }).toArray()).map(
(agent) => agent.agentId,
);
await LivechatDepartmentAgents.removeByDepartmentId(_id);
await LivechatDepartmentRaw.unsetFallbackDepartmentByDepartmentId(_id);
if (ret) {
setImmediate(() => {
callbacks.run('livechat.afterRemoveDepartment', { department, agentsIds });
});
}
return ret;
},

showConnecting() {
const { showConnecting } = RoutingManager.getConfig();
return showConnecting;
Expand Down

0 comments on commit 5a8f429

Please sign in to comment.