added check for duplicate mails
This commit is contained in:
@@ -38,11 +38,17 @@ export function parseMails(config: any, dataSafe: SecureVault) {
|
|||||||
// check if already exist
|
// check if already exist
|
||||||
dataSafe.writeTransaction(`reading mail ${line.substr(0,ix)} from category ${currSection}`);
|
dataSafe.writeTransaction(`reading mail ${line.substr(0,ix)} from category ${currSection}`);
|
||||||
if (config.force || config.usedMails.filter((el: MLItem) => el.mail == line.substr(0,ix)).length == 0){
|
if (config.force || config.usedMails.filter((el: MLItem) => el.mail == line.substr(0,ix)).length == 0){
|
||||||
mailArray.push({
|
// check for duplicate
|
||||||
mail: line.substr(0,ix),
|
if ( mailArray.filter((el: MLItem) => el.mail == line.substr(0,ix)).length == 0){
|
||||||
name: line.substr(ix + 1)
|
mailArray.push({
|
||||||
})
|
mail: line.substr(0,ix),
|
||||||
curCounter ++;
|
name: line.substr(ix + 1)
|
||||||
|
})
|
||||||
|
curCounter ++;
|
||||||
|
}else{
|
||||||
|
dataSafe.writeTransaction(` -> duplicate mail. Skipping`);
|
||||||
|
console.error(`Skipping ${line.substr(0,ix)}: Duplicate`)
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
dataSafe.writeTransaction(` -> already exists. Skipping`);
|
dataSafe.writeTransaction(` -> already exists. Skipping`);
|
||||||
console.error(`Skipping ${line.substr(0,ix)}: Already sent`)
|
console.error(`Skipping ${line.substr(0,ix)}: Already sent`)
|
||||||
|
|||||||
Reference in New Issue
Block a user