Add rule enable toggle
This commit is contained in:
parent
5cc897a668
commit
fa84f37637
3 changed files with 25 additions and 5 deletions
|
@ -36,6 +36,7 @@ function normalizeRules(rules) {
|
|||
if (r.actions) {
|
||||
if (!Array.isArray(r.accounts)) r.accounts = [];
|
||||
if (!Array.isArray(r.folders)) r.folders = [];
|
||||
r.enabled = r.enabled !== false;
|
||||
return r;
|
||||
}
|
||||
const actions = [];
|
||||
|
@ -49,6 +50,7 @@ function normalizeRules(rules) {
|
|||
if (typeof r.maxAgeDays === 'number') rule.maxAgeDays = r.maxAgeDays;
|
||||
if (Array.isArray(r.accounts)) rule.accounts = r.accounts;
|
||||
if (Array.isArray(r.folders)) rule.folders = r.folders;
|
||||
rule.enabled = r.enabled !== false;
|
||||
return rule;
|
||||
}) : [];
|
||||
}
|
||||
|
@ -234,6 +236,9 @@ async function processMessage(id) {
|
|||
}
|
||||
|
||||
for (const rule of aiRules) {
|
||||
if (rule.enabled === false) {
|
||||
continue;
|
||||
}
|
||||
if (hdr && Array.isArray(rule.accounts) && rule.accounts.length &&
|
||||
!rule.accounts.includes(hdr.folder.accountId)) {
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue