RealRaven2000 / quickFilters

Thunderbird Add-on: quickFilters
http://quickfilters.quickfolders.org/
Other
46 stars 11 forks source link

Merging to a filter with "Subject" template breaks filter #161

Closed PotatoCarl closed 1 year ago

PotatoCarl commented 1 year ago

Hi, When I create a filter with a subject filter, it breaks an existing filter an no filters are used anymore.

RealRaven2000 commented 1 year ago

Hi PotatoCarl, can you give me more detail? Did you merge with subject? I assume this is a normal filter on Thunderbird?

note that quickFilters does not currently support merging into "complicated" filters in Betterbird that have mixed any / all operators. You can export the broken filter by highlighting it in the message filters window and then clicking the backup button while holding CTRL:

image

PotatoCarl commented 1 year ago

heres the filter

xxx_2023-02-17_16-17.txt

RealRaven2000 commented 1 year ago

this is very strange:

image

looks like there is something weird going on with that String, like there are unprintable characters in it... could you forward me the email you made this from to my support address please?

RealRaven2000 commented 1 year ago

So I am finding that when I add a new subject using the merge function with the "subject" template, there is a problem with internally "mixed" operators (any / all) this definitely needs fixing ASAP. In the meantime, you can fix such cases in Thunderbird via the troubleshoot button:

image

You can skip the first step but if you get a message like this:

image

You can ask quickFilters to repair these filters. It will replace the wrong operators "all" with "any". (Internally Thunderbird allows mixing any / all, there is just no UI that supports this.

Careful Betterbird Users: Some Filters may have mixed any / all conditions and parentheses (created through their new UI) - these can currently not be repaired reliably with quickFIlters! This is just too complex at the moment. In Betterbird, if you want to repair potentially broken filters with mixed any/all conditions, you can only do it by exporting to a file and then editing that manually. quickFilters might detect working filters (with mixed conditions) as faulty that are actually working as intended.

We have to add a lot of programming logic to support troubleshooting this (and the merging function) when "mixed operator" filters are created. It will definitely come in some future versions, but for now I am concentrating on Thunderbird.

RealRaven2000 commented 1 year ago

Here is a first attempt at fixing this:

quickFilters-wx-5.8.1pre11.zip

This will check if there are already search terms and use the "any" operator (booleanAnd = false) if the very first search term also uses "any". The main problem is if you already have message up filters there may already be a single mixed "all" operator in one of the following search terms, so I feel like I really need to do a full sanity check on all the "booleanAnd" parameters of every search term in the existing filter when merging. This however would need to be done with caution in case we are in Betterbird and there was a genuine mixed operator filter, such as:

Term a  AND
(Term B OR Term C)

in this example we have:

A.booleanAnd = true
A.beginsGrouping = false
A.endsGrouping = false

B.booleanAnd = false
B.beginsGrouping = true
B.endsGrouping = false

C.booleanAnd = false
C.beginsGrouping = false
C.endsGrouping = true

in this case what should the new term D use? I could imagine it to try to insert into the last group, such as:

Term a AND (Term b OR Term C OR Term D)

For this it would need to copy the operator (booleanAnd=false) from the last term, and then remove endsGrouping and set it to the new element instead. This can get quite complicated and messy quickly.

Anyway, for Thunderbird please download the zip file above and drag it into your Thunderbird Add-ons Manager to install and try out.

RealRaven2000 commented 1 year ago

Fixed in 5.8.1 released on 18/02/2023