Skip to content

Commit af22f15

Browse files
committed
[push] Auto messages fixes
1 parent 1e7d66f commit af22f15

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

plugins/push/api/parts/endpoints.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,16 @@ function catchy(f) {
469469
}
470470

471471
if (data.auto) {
472-
if (!data.autoCohorts || !data.autoCohorts.length) {
473-
return [{error: 'Cohorts are required for auto messages'}];
474-
}
475-
if (!cohorts || data.autoCohorts.length != cohorts.length) {
476-
return [{error: 'Cohort not found'}];
477-
}
478-
if (data.autoOnEntry !== false && data.autoOnEntry !== true) {
479-
return [{error: 'autoOnEntry is required for auto messages'}];
472+
if (!skipMpl) {
473+
if (!data.autoCohorts || !data.autoCohorts.length) {
474+
return [{error: 'Cohorts are required for auto messages'}];
475+
}
476+
if (!cohorts || data.autoCohorts.length != cohorts.length) {
477+
return [{error: 'Cohort not found'}];
478+
}
479+
if (data.autoOnEntry !== false && data.autoOnEntry !== true) {
480+
return [{error: 'autoOnEntry is required for auto messages'}];
481+
}
480482
}
481483
} else if (data.tx) {
482484

@@ -540,7 +542,7 @@ function catchy(f) {
540542
tx: data.tx || false,
541543
auto: data.auto || false,
542544
autoOnEntry: data.auto ? data.autoOnEntry : undefined,
543-
autoCohorts: data.auto ? cohorts.map(c => c._id) : undefined,
545+
autoCohorts: data.auto && cohorts ? cohorts.map(c => c._id) : undefined,
544546
autoEnd: data.auto ? data.autoEnd : undefined,
545547
autoDelay: data.auto ? data.autoDelay : undefined,
546548
autoTime: data.auto ? data.autoTime : undefined,

0 commit comments

Comments
 (0)