Skip to content

Commit

Permalink
remove notify from LivechatDepartment
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Dec 24, 2024
1 parent 444d03f commit 005bd2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions apps/meteor/app/livechat/server/lib/departmentsLib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ export async function saveDepartment(
await updateDepartmentAgents(departmentDB._id, departmentAgents, departmentDB.enabled);
}

if (department?.enabled !== departmentData.enabled) {
void notifyOnLivechatDepartmentAgentChangedByDepartmentId(departmentDB._id, department ? 'updated' : 'inserted');
}

// Disable event
if (department?.enabled && !departmentDB?.enabled) {
await callbacks.run('livechat.afterDepartmentDisabled', departmentDB);
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/server/models/raw/LivechatDepartment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type {
} from 'mongodb';

import { BaseRaw } from './BaseRaw';
import { notifyOnLivechatDepartmentAgentChangedByDepartmentId } from '../../../app/lib/server/lib/notifyListener';

export class LivechatDepartmentRaw extends BaseRaw<ILivechatDepartment> implements ILivechatDepartmentModel {
constructor(db: Db, trash?: Collection<RocketChatRecordDeleted<ILivechatDepartment>>) {
Expand Down Expand Up @@ -260,7 +259,6 @@ export class LivechatDepartmentRaw extends BaseRaw<ILivechatDepartment> implemen

if (current?.enabled !== data.enabled) {
await LivechatDepartmentAgents.setDepartmentEnabledByDepartmentId(_id, data.enabled);
void notifyOnLivechatDepartmentAgentChangedByDepartmentId(_id, current ? 'updated' : 'inserted');
}

const latestDept = await this.findOneById(_id);
Expand Down

0 comments on commit 005bd2f

Please sign in to comment.