Fixed some bugs in subscription process
Added timezone selector to campaign scheduling Fixed problems with pausing campaign.
This commit is contained in:
parent
4113cb8476
commit
e3a5a3c4eb
23 changed files with 218 additions and 99 deletions
|
@ -44,7 +44,7 @@ router.postAsync('/subscribe/:listCid', passport.loggedIn, async (req, res) => {
|
|||
|
||||
const emailErr = await tools.validateEmail(input.EMAIL);
|
||||
if (emailErr) {
|
||||
const errMsg = tools.validateEmailGetMessage(emailErr, input.email);
|
||||
const errMsg = tools.validateEmailGetMessage(emailErr, input.email, null);
|
||||
log.error('API', errMsg);
|
||||
throw new APIError(errMsg, 400);
|
||||
}
|
||||
|
|
|
@ -74,11 +74,13 @@ router.deleteAsync('/campaigns/:campaignId', passport.loggedIn, passport.csrfPro
|
|||
});
|
||||
|
||||
router.postAsync('/campaign-start/:campaignId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
return res.json(await campaigns.start(req.context, castToInteger(req.params.campaignId), null));
|
||||
return res.json(await campaigns.start(req.context, castToInteger(req.params.campaignId), {startAt: null}));
|
||||
});
|
||||
|
||||
router.postAsync('/campaign-start-at/:campaignId/:dateTime', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
return res.json(await campaigns.start(req.context, castToInteger(req.params.campaignId), new Date(Number.parseInt(req.params.dateTime))));
|
||||
router.postAsync('/campaign-start-at/:campaignId', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
const startAt = new Date(req.body.startAt);
|
||||
const timezone = req.body.timezone;
|
||||
return res.json(await campaigns.start(req.context, castToInteger(req.params.campaignId), {startAt, timezone}));
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ router.postAsync('/:cid/subscribe', passport.parseForm, corsOrCsrfProtection, as
|
|||
|
||||
const emailErr = await tools.validateEmail(email);
|
||||
if (emailErr) {
|
||||
const errMsg = tools.validateEmailGetMessage(emailErr, email);
|
||||
const errMsg = tools.validateEmailGetMessage(emailErr, email, req.locale);
|
||||
|
||||
if (req.xhr) {
|
||||
throw new Error(errMsg);
|
||||
|
@ -457,7 +457,7 @@ router.postAsync('/:lcid/manage-address', passport.parseForm, passport.csrfProte
|
|||
} else {
|
||||
const emailErr = await tools.validateEmail(emailNew);
|
||||
if (emailErr) {
|
||||
const errMsg = tools.validateEmailGetMessage(emailErr, email);
|
||||
const errMsg = tools.validateEmailGetMessage(emailErr, email, req.locale);
|
||||
|
||||
req.flash('danger', errMsg);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue