- Removes scheduling of post notification during newsletter activation stage

This commit is contained in:
Vlad
2016-07-14 20:29:36 -04:00
parent 7605fc71ac
commit db85604f18

View File

@ -37,8 +37,10 @@ class SendingQueue {
);
}
if($newsletter->type === Newsletter::TYPE_WELCOME) {
// set welcome email active
if($newsletter->type === Newsletter::TYPE_WELCOME ||
$newsletter->type === Newsletter::TYPE_NOTIFICATION
) {
// set newsletter status to active
$result = $newsletter->setStatus(Newsletter::STATUS_ACTIVE);
$errors = $result->getErrors();
@ -48,20 +50,16 @@ class SendingQueue {
'errors' => $errors
);
} else {
$message = ($newsletter->type === Newsletter::TYPE_WELCOME) ?
__('Your welcome email has been activated') :
__('Your post notification has been activated');
return array(
'result' => true,
'data' => array(
'message' => __('Your welcome email has been activated')
'message' => $message
)
);
}
} else if($newsletter->type === Newsletter::TYPE_NOTIFICATION) {
// Post Notifications
$newsletter = Scheduler::processPostNotificationSchedule($newsletter->id);
Scheduler::createPostNotificationQueue($newsletter);
// set post notification active
$newsletter->setStatus(Newsletter::STATUS_ACTIVE);
}
$queue = SendingQueueModel::whereNull('status')
@ -83,18 +81,6 @@ class SendingQueue {
$queue->newsletter_id = $newsletter->id;
}
if($newsletter->type === Newsletter::TYPE_NOTIFICATION) {
$queue->scheduled_at = Scheduler::getNextRunDate($newsletter->schedule);
$queue->status = SendingQueueModel::STATUS_SCHEDULED;
$queue->save();
return array(
'result' => true,
'data' => array(
'message' => __('Your post notification has been activated')
)
);
}
if((bool)$newsletter->isScheduled) {
// set newsletter status
$newsletter->setStatus(Newsletter::STATUS_SCHEDULED);
@ -188,4 +174,4 @@ class SendingQueue {
'result' => $result
);
}
}
}