mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 05:59:21 +03:00
Prepare Sieve Filtering feature for advanced editing/handling
This commit is contained in:
parent
4e1722560f
commit
e023a5d6ab
4 changed files with 72 additions and 81 deletions
|
|
@ -103,11 +103,11 @@ class FiltersUserSettings {
|
|||
data.Result.Filters.map(aItem => FilterModel.reviveFromJson(aItem)).filter(v => v)
|
||||
);
|
||||
|
||||
this.modules(data.Result.Modules ? data.Result.Modules : {});
|
||||
this.modules(data.Result.Capa);
|
||||
|
||||
this.filterRaw(data.Result.Raw || '');
|
||||
this.filterRaw.capa(Array.isArray(data.Result.Capa) ? data.Result.Capa.join(' ') : '');
|
||||
this.filterRaw.active(!!data.Result.RawIsActive);
|
||||
this.filterRaw(data.Result.Scripts['rainloop.user.raw'].body);
|
||||
this.filterRaw.capa(data.Result.Capa.join(' '));
|
||||
this.filterRaw.active(data.Result.Scripts['rainloop.user.raw'].active);
|
||||
this.filterRaw.allow(!!data.Result.RawIsAllow);
|
||||
} else {
|
||||
this.filters([]);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class FilterUserStore {
|
|||
constructor() {
|
||||
ko.addObservablesTo(this, {
|
||||
capa: '',
|
||||
modules: {},
|
||||
modules: [],
|
||||
raw: ''
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -67,50 +67,12 @@ class FilterPopupView extends AbstractViewNext {
|
|||
populateOptions() {
|
||||
this.actionTypeOptions([]);
|
||||
|
||||
// this.actionTypeOptions.push({'id': FiltersAction.None,
|
||||
// 'name': i18n('POPUPS_FILTER/SELECT_ACTION_NONE')});
|
||||
|
||||
const modules = this.modules();
|
||||
if (modules) {
|
||||
if (modules.markasread) {
|
||||
this.allowMarkAsRead(true);
|
||||
}
|
||||
|
||||
if (modules.moveto) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FiltersAction.MoveTo,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')
|
||||
});
|
||||
}
|
||||
|
||||
if (modules.redirect) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FiltersAction.Forward,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')
|
||||
});
|
||||
}
|
||||
|
||||
if (modules.reject) {
|
||||
this.actionTypeOptions.push({ 'id': FiltersAction.Reject, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_REJECT') });
|
||||
}
|
||||
|
||||
if (modules.vacation) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FiltersAction.Vacation,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.actionTypeOptions.push({ 'id': FiltersAction.Discard, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD') });
|
||||
|
||||
this.fieldOptions([
|
||||
{ 'id': FilterConditionField.From, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_FROM') },
|
||||
{ 'id': FilterConditionField.Recipient, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS') },
|
||||
{ 'id': FilterConditionField.Subject, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT') },
|
||||
{ 'id': FilterConditionField.Size, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_SIZE') },
|
||||
{ 'id': FilterConditionField.Header, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_HEADER') },
|
||||
{ 'id': FilterConditionField.Body, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_BODY') }
|
||||
{ 'id': FilterConditionField.Header, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_HEADER') }
|
||||
]);
|
||||
|
||||
this.typeOptions([
|
||||
|
|
@ -120,10 +82,47 @@ class FilterPopupView extends AbstractViewNext {
|
|||
{ 'id': FilterConditionType.NotEqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO') }
|
||||
]);
|
||||
|
||||
if (modules && modules.regex) {
|
||||
this.typeOptions.push({ 'id': FilterConditionType.Regex, 'name': 'Regex' });
|
||||
// this.actionTypeOptions.push({'id': FiltersAction.None,
|
||||
// 'name': i18n('POPUPS_FILTER/SELECT_ACTION_NONE')});
|
||||
const modules = this.modules();
|
||||
if (modules) {
|
||||
if (modules.includes('imap4flags')) {
|
||||
this.allowMarkAsRead(true);
|
||||
}
|
||||
|
||||
if (modules.includes('fileinto')) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FiltersAction.MoveTo,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')
|
||||
});
|
||||
this.actionTypeOptions.push({
|
||||
'id': FiltersAction.Forward,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')
|
||||
});
|
||||
}
|
||||
|
||||
if (modules.includes('reject')) {
|
||||
this.actionTypeOptions.push({ 'id': FiltersAction.Reject, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_REJECT') });
|
||||
}
|
||||
|
||||
if (modules.includes('vacation')) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FiltersAction.Vacation,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')
|
||||
});
|
||||
}
|
||||
|
||||
if (modules.includes('body')) {
|
||||
this.fieldOptions.push({ 'id': FilterConditionField.Body, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_BODY') });
|
||||
}
|
||||
|
||||
if (modules.includes('regex')) {
|
||||
this.typeOptions.push({ 'id': FilterConditionType.Regex, 'name': 'Regex' });
|
||||
}
|
||||
}
|
||||
|
||||
this.actionTypeOptions.push({ 'id': FiltersAction.Discard, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD') });
|
||||
|
||||
this.typeOptionsSize([
|
||||
{ 'id': FilterConditionType.Over, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_OVER') },
|
||||
{ 'id': FilterConditionType.Under, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_UNDER') }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue