Regression: Fix Inactive Departments still visible on Livechat (#24267)

pull/24269/head^2
Murtaza Patrawala 3 years ago committed by GitHub
parent b28ec58ed7
commit 7cfd4b0c24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      app/models/server/models/LivechatDepartment.js
  2. 2
      ee/app/models/server/models/LivechatDepartment.js

@ -138,6 +138,19 @@ export class LivechatDepartment extends Base {
return this.find(query, options);
}
findActiveByUnitIds(unitIds, options) {
const query = {
enabled: true,
numAgents: { $gt: 0 },
parentId: {
$exists: true,
$in: unitIds,
},
};
return this.find(query, options);
}
unsetFallbackDepartmentByDepartmentId(_id) {
return this.update(
{ fallbackForwardDepartment: _id },

@ -51,7 +51,7 @@ overwriteClassOnLicense('livechat-enterprise', LivechatDepartment, {
throw new Meteor.Error('error-unit-not-found', `Error! No Active Business Unit found with id: ${businessUnit}`);
}
return LivechatDepartmentModel.findByUnitIds([businessUnit], { fields });
return LivechatDepartmentModel.findActiveByUnitIds([businessUnit], { fields });
},
});

Loading…
Cancel
Save