Satisfy eslint rule indent
This commit is contained in:
parent
44ab04624b
commit
c7ba0235c5
1 changed files with 56 additions and 56 deletions
|
@ -141,72 +141,72 @@ function processImport(data, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function insertToSubscription() {
|
function insertToSubscription() {
|
||||||
subscriptions.insert(listId, {
|
subscriptions.insert(listId, {
|
||||||
imported: data.id,
|
imported: data.id,
|
||||||
status: data.type,
|
status: data.type,
|
||||||
partial: true
|
partial: true
|
||||||
}, entry, (err, response) => {
|
}, entry, (err, response) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
// ignore
|
// ignore
|
||||||
log.error('Import', err.stack);
|
log.error('Import', err.stack);
|
||||||
} else if (response.entryId) {
|
} else if (response.entryId) {
|
||||||
//log.verbose('Import', 'Inserted %s as %s', entry.email, entryId);
|
//log.verbose('Import', 'Inserted %s as %s', entry.email, entryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
db.getConnection((err, connection) => {
|
|
||||||
if (err) {
|
|
||||||
log.error('Import', err.stack);
|
|
||||||
return setImmediate(processRows);
|
|
||||||
}
|
|
||||||
|
|
||||||
let query;
|
|
||||||
if (response.inserted) {
|
|
||||||
// this record did not exist before, count as new
|
|
||||||
query = 'UPDATE importer SET `processed`=`processed`+1, `new`=`new`+1 WHERE `id`=? LIMIT 1';
|
|
||||||
} else {
|
|
||||||
// it's an existing record
|
|
||||||
query = 'UPDATE importer SET `processed`=`processed`+1 WHERE `id`=? LIMIT 1';
|
|
||||||
}
|
|
||||||
|
|
||||||
connection.query(query, [data.id], () => {
|
|
||||||
connection.release();
|
|
||||||
return setImmediate(processRows);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.emailcheck === 1) {
|
|
||||||
tools.validateEmail(entry.email, true, err => {
|
|
||||||
if (err) {
|
|
||||||
let reason = (err.message || '').toString().trim().replace(/^[a-z]Error:\s*/i, '');
|
|
||||||
log.verbose('Import', 'Failed processing row %s: %s', entry.email, reason);
|
|
||||||
db.getConnection((err, connection) => {
|
db.getConnection((err, connection) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error('Import', err.stack);
|
log.error('Import', err.stack);
|
||||||
return setImmediate(processRows);
|
return setImmediate(processRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
let query = 'INSERT INTO import_failed (`import`, `email`, `reason`) VALUES(?,?,?)';
|
let query;
|
||||||
connection.query(query, [data.id, entry.email, reason], err => {
|
if (response.inserted) {
|
||||||
if (err) {
|
// this record did not exist before, count as new
|
||||||
connection.release();
|
query = 'UPDATE importer SET `processed`=`processed`+1, `new`=`new`+1 WHERE `id`=? LIMIT 1';
|
||||||
return setImmediate(processRows);
|
} else {
|
||||||
}
|
// it's an existing record
|
||||||
let query = 'UPDATE importer SET `failed`=`failed`+1 WHERE `id`=? LIMIT 1';
|
query = 'UPDATE importer SET `processed`=`processed`+1 WHERE `id`=? LIMIT 1';
|
||||||
connection.query(query, [data.id], () => {
|
}
|
||||||
connection.release();
|
|
||||||
return setImmediate(processRows);
|
connection.query(query, [data.id], () => {
|
||||||
});
|
connection.release();
|
||||||
|
return setImmediate(processRows);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.emailcheck === 1) {
|
||||||
|
tools.validateEmail(entry.email, true, err => {
|
||||||
|
if (err) {
|
||||||
|
let reason = (err.message || '').toString().trim().replace(/^[a-z]Error:\s*/i, '');
|
||||||
|
log.verbose('Import', 'Failed processing row %s: %s', entry.email, reason);
|
||||||
|
db.getConnection((err, connection) => {
|
||||||
|
if (err) {
|
||||||
|
log.error('Import', err.stack);
|
||||||
|
return setImmediate(processRows);
|
||||||
|
}
|
||||||
|
|
||||||
|
let query = 'INSERT INTO import_failed (`import`, `email`, `reason`) VALUES(?,?,?)';
|
||||||
|
connection.query(query, [data.id, entry.email, reason], err => {
|
||||||
|
if (err) {
|
||||||
|
connection.release();
|
||||||
|
return setImmediate(processRows);
|
||||||
|
}
|
||||||
|
let query = 'UPDATE importer SET `failed`=`failed`+1 WHERE `id`=? LIMIT 1';
|
||||||
|
connection.query(query, [data.id], () => {
|
||||||
|
connection.release();
|
||||||
|
return setImmediate(processRows);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
insertToSubscription();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
insertToSubscription();
|
insertToSubscription();
|
||||||
});
|
}
|
||||||
} else {
|
|
||||||
insertToSubscription();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
parser.on('readable', () => {
|
parser.on('readable', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue