mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 15:08:28 +03:00
Revamp array filtering
Replaced fakeMd5 with new Jua.randomId Cleanup more code
This commit is contained in:
parent
9992b20163
commit
c3a2da65df
23 changed files with 130 additions and 289 deletions
|
|
@ -440,7 +440,7 @@ class EmailModel {
|
|||
if (parsedResult.length) {
|
||||
return parsedResult.map(item =>
|
||||
item.address ? new EmailModel(item.address.replace(/^[<]+(.*)[>]+$/g, '$1'), item.name || '') : null
|
||||
).filter(value => !!value);
|
||||
).filter(v => v);
|
||||
}
|
||||
|
||||
return [];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { FilterRulesType, FiltersAction } from 'Common/Enums';
|
||||
import { pString, fakeMd5, delegateRunOnDestroy } from 'Common/Utils';
|
||||
import { pString, delegateRunOnDestroy } from 'Common/Utils';
|
||||
import { i18n } from 'Common/Translator';
|
||||
import { getFolderFromCacheList } from 'Common/Cache';
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ class FilterModel extends AbstractModel {
|
|||
}
|
||||
|
||||
generateID() {
|
||||
this.id = fakeMd5();
|
||||
this.id = Jua.randomId();
|
||||
}
|
||||
|
||||
verify() {
|
||||
|
|
@ -230,7 +230,7 @@ class FilterModel extends AbstractModel {
|
|||
json.Conditions.map(aData => {
|
||||
const filterCondition = new FilterConditionModel();
|
||||
return filterCondition && filterCondition.parse(aData) ? filterCondition : null;
|
||||
}).filter(value => !!value)
|
||||
}).filter(v => v)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ class MessageModel extends AbstractModel {
|
|||
getEmails(properties) {
|
||||
return properties.reduce((carry, property) => carry.concat(this[property]), []).map(
|
||||
oItem => oItem ? oItem.email : ''
|
||||
).filter((value, index, self) => !!value && self.indexOf(value) == index);
|
||||
).validUnique();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue