Add option to preserve unsubscribed status on list import, #325
This commit is contained in:
parent
5ada25c2dc
commit
c5b481a266
3 changed files with 14 additions and 2 deletions
|
@ -574,7 +574,14 @@ router.post('/subscription/import', uploads.single('listimport'), passport.parse
|
|||
return res.redirect('/lists');
|
||||
} else {
|
||||
|
||||
subscriptions.createImport(list.id, req.body.type === 'subscribed' ? 1 : 2, req.file.path, req.file.size, delimiter, req.body.emailcheck === 'enabled' ? 1 : 0, {
|
||||
let type = 0; // Use the existing subscription status or SUBSCRIBED
|
||||
if (req.body.type === 'force_subscribed') {
|
||||
type = subscriptions.Status.SUBSCRIBED;
|
||||
} else if (req.body.type === 'unsubscribed') {
|
||||
type = subscriptions.Status.UNSUBSCRIBED;
|
||||
}
|
||||
|
||||
subscriptions.createImport(list.id, type, req.file.path, req.file.size, delimiter, req.body.emailcheck === 'enabled' ? 1 : 0, {
|
||||
columns: rows[0],
|
||||
example: rows[1] || []
|
||||
}, (err, importId) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue