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
|
@ -625,7 +625,7 @@ module.exports.delete = (listId, cid, callback) => {
|
|||
|
||||
module.exports.createImport = (listId, type, path, size, delimiter, emailcheck, mapping, callback) => {
|
||||
listId = Number(listId) || 0;
|
||||
type = Number(type) || 1;
|
||||
type = Number(type) || 0;
|
||||
|
||||
if (listId < 1) {
|
||||
return callback(new Error('Missing List ID'));
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -35,6 +35,11 @@
|
|||
<input type="radio" name="type" id="type" value="subscribed" checked> {{#translate}}Subscribed{{/translate}} – <span class="text-muted">{{#translate}}Regular subscriber addresses{{/translate}}</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="type" id="type" value="force_subscribed"> {{#translate}}Subscribed (Force){{/translate}} – <span class="text-muted">{{#translate}}Regular subscriber addresses, resubscribe users that have unsubscribed{{/translate}}</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="type" id="type" value="unsubscribed"> {{#translate}}Unsubscribed{{/translate}} – <span class="text-muted">{{#translate}}Suppressed emails that will be unsubscribed from your list{{/translate}}</span>
|
||||
|
|
Loading…
Reference in a new issue