Skip to content

Commit

Permalink
Regression: Incorrect system message upon adding/editing SLA policy f…
Browse files Browse the repository at this point in the history
…or a room. (#28151)
  • Loading branch information
murtaza98 authored Feb 28, 2023
1 parent adbc8e5 commit 70466e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function findSLA({
export const updateRoomSLA = async (
roomId: string,
user: Required<Pick<IUser, '_id' | 'username' | 'name'>>,
sla: IOmnichannelServiceLevelAgreements,
sla: Pick<IOmnichannelServiceLevelAgreements, '_id' | 'name' | 'dueTimeInMinutes'>,
) => {
await Promise.all([updateInquiryQueueSla(roomId, sla), updateRoomSlaWeights(roomId, sla), addSlaChangeHistoryToRoom(roomId, user, sla)]);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IOmnichannelRoom, IUser } from '@rocket.chat/core-typings';
import type { IOmnichannelRoom, IOmnichannelServiceLevelAgreements, IUser } from '@rocket.chat/core-typings';
import { OmnichannelServiceLevelAgreements } from '@rocket.chat/models';

import { callbacks } from '../../../../../lib/callbacks';
Expand All @@ -11,7 +11,10 @@ const updateSLA = async (room: IOmnichannelRoom, user: Required<Pick<IUser, '_id
return removeRoomSLA(room._id, user);
}

const sla = await OmnichannelServiceLevelAgreements.findOneById(slaId, { projection: { _id: 1, dueTimeInMinutes: 1 } });
const sla: Pick<IOmnichannelServiceLevelAgreements, '_id' | 'name' | 'dueTimeInMinutes'> | null =
await OmnichannelServiceLevelAgreements.findOneById(slaId, {
projection: { _id: 1, name: 1, dueTimeInMinutes: 1 },
});
if (!sla) {
throw new Error(`SLA not found with id: ${slaId}`);
}
Expand Down

0 comments on commit 70466e9

Please sign in to comment.