Skip to content

Commit

Permalink
regression: saveGuest triggering app events for invalid visitor ids (
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman authored Nov 21, 2023
1 parent dd3ecd6 commit 9045c0d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/meteor/app/livechat/server/lib/LivechatTyped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,12 @@ class LivechatClass {

async saveGuest(guestData: Pick<ILivechatVisitor, '_id' | 'name' | 'livechatData'> & { email?: string; phone?: string }, userId: string) {
const { _id, name, email, phone, livechatData = {} } = guestData;

const visitor = await LivechatVisitors.findOneById(_id, { projection: { _id: 1 } });
if (!visitor) {
throw new Error('error-invalid-visitor');
}

this.logger.debug({ msg: 'Saving guest', guestData });
const updateData: {
name?: string | undefined;
Expand Down

0 comments on commit 9045c0d

Please sign in to comment.