Skip to content

Commit

Permalink
room - addToSet
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman committed Sep 11, 2023
1 parent 4eed56d commit 79a69e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions apps/meteor/app/livechat/server/hooks/markRoomResponded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ callbacks.add(

// Return YYYY-MM from moment
const monthYear = moment().format('YYYY-MM');
if (!(await LivechatVisitors.isVisitorActiveOnPeriod(room.v._id, monthYear))) {
await Promise.all([
LivechatVisitors.markVisitorActiveForPeriod(room.v._id, monthYear),
LivechatRooms.markVisitorActiveForPeriod(room._id, monthYear),
]);
const isVisitorActive = await LivechatVisitors.isVisitorActiveOnPeriod(room.v._id, monthYear);
if (!isVisitorActive) {
await LivechatVisitors.markVisitorActiveForPeriod(room.v._id, monthYear);
}

await LivechatRooms.markVisitorActiveForPeriod(room._id, monthYear);

if (room.responseBy) {
await LivechatRooms.setAgentLastMessageTs(room._id);
}
Expand Down
7 changes: 2 additions & 5 deletions apps/meteor/server/models/raw/LivechatRooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2458,11 +2458,8 @@ export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILive
};

const update = {
$push: {
'v.activity': {
$each: [period],
$slice: -12,
},
$addToSet: {
'v.activity': period,
},
};

Expand Down

0 comments on commit 79a69e0

Please sign in to comment.