Skip to content

Commit

Permalink
fix: test_mode validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tapiarafael committed Sep 3, 2024
1 parent 58df14e commit 4e0a0bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions apps/meteor/app/livechat/server/api/v1/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ API.v1.addRoute(
{ authRequired: true, permissionsRequired: ['create-livechat-contact'], validateParams: isPOSTOmnichannelContactsProps },
{
async post() {
if (!process.env.TEST_MODE) {
if (process.env.TEST_MODE?.toUpperCase() !== 'TRUE') {
throw new Meteor.Error('error-not-allowed', 'This endpoint is only allowed in test mode');
}
const contactId = await createContact({ ...this.bodyParams, unknown: false });
Expand All @@ -106,7 +106,7 @@ API.v1.addRoute(
{ authRequired: true, permissionsRequired: ['update-livechat-contact'], validateParams: isPOSTUpdateOmnichannelContactsProps },
{
async post() {
if (!process.env.TEST_MODE) {
if (process.env.TEST_MODE?.toUpperCase() !== 'TRUE') {
throw new Meteor.Error('error-not-allowed', 'This endpoint is only allowed in test mode');
}

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/livechat/server/lib/LivechatTyped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ class LivechatClass {
}
}

if (process.env.TEST_MODE?.toUpperCase() === 'TRUE') {
if (process.env.TEST_MODE?.toUpperCase() !== 'TRUE') {
const contactId = await createContact({
name: name ?? (visitorDataToUpdate.username as string),
emails: email ? [email] : [],
Expand Down

0 comments on commit 4e0a0bb

Please sign in to comment.