From 0ffe5bf9e5b35b27371dab9d17f3cc9cda9f57bf Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 9 Apr 2025 22:41:23 +0200 Subject: [PATCH] Allow standalone older than condition --- app/src/main/java/eu/faircode/email/EntityRule.java | 6 ++++-- app/src/main/java/eu/faircode/email/FragmentRule.java | 10 +++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java index a8121340a9..75628bcbc4 100644 --- a/app/src/main/java/eu/faircode/email/EntityRule.java +++ b/app/src/main/java/eu/faircode/email/EntityRule.java @@ -246,10 +246,11 @@ public class EntityRule { JSONObject jcondition = new JSONObject(condition); // general + int age = 0; if (this.daily) { JSONObject jgeneral = jcondition.optJSONObject("general"); if (jgeneral != null) { - int age = jgeneral.optInt("age"); + age = jgeneral.optInt("age"); if (age > 0) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(message.received); @@ -505,7 +506,8 @@ public class EntityRule { } // Safeguard - if (jsender == null && + if (age == 0 && + jsender == null && jrecipient == null && jsubject == null && !jcondition.optBoolean("attachments") && diff --git a/app/src/main/java/eu/faircode/email/FragmentRule.java b/app/src/main/java/eu/faircode/email/FragmentRule.java index 6671960be3..d1d1325f00 100644 --- a/app/src/main/java/eu/faircode/email/FragmentRule.java +++ b/app/src/main/java/eu/faircode/email/FragmentRule.java @@ -1686,7 +1686,15 @@ public class FragmentRule extends FragmentBase { } } - if (jsender == null && + int age = 0; + if (daily) { + JSONObject jgeneral = jcondition.optJSONObject("general"); + if (jgeneral != null) + age = jgeneral.optInt("age"); + } + + if (age == 0 && + jsender == null && jrecipient == null && jsubject == null && !jcondition.optBoolean("attachments") &&