[Bug] Boolean lines in contact allowlists with more than one OR don't work
I've managed to track down the bug in Hubzilla's Boolean lines:If you have a filter line with Boolean operators in an allowlist for a contact, and this line contains more than one OR (||), the line doesn't work properly; only the first entry does.
If your filter line is
?body ~= foo || ?body ~= bar, posts with "foo" as well as posts with "bar" will be accepted and delivered.If your filter line is
?body ~= foo || ?body ~= bar || ?body ~= baz, only posts with "foo" will be accepted and delivered. Posts with "bar" and posts with "baz" will be ignored.Steps to reproduce:
- Have two Hubzilla channels that are connected to each other.
- Have per-contact filters activated.
- Edit the contact of one channel.
- Add to the per-contact filter allowlist:
?body ~= foo || ?body ~= bar - Switch to the other channel.
- Send this post:
"Test post with foo" - Check the delivery report.
- Send this post:
"Test post with bar" - Check the delivery report.
- Switch back to the first channel.
- Edit the filter line from:
?body ~= foo || ?body ~= bar
to:?body ~= foo || ?body ~= bar || ?body ~= baz - Switch back to the other channel.
- Send this post:
"New test post with foo" - Check the delivery report.
- Send this post:
"New test post with bar" - Check the delivery report.
- Send this post:
"New test post with baz" - Check the delivery report.
Expected and desired outcome:
- "Test post with foo:"
Delivered because?body ~= foo || ?body ~= barallowlists it. - "Test post with bar:"
Delivered because?body ~= foo || ?body ~= barallowlists it. - "New test post with foo:"
Delivered because?body ~= foo || ?body ~= bar || ?body ~= bazallowlists it. - "New test post with bar:"
Delivered because?body ~= foo || ?body ~= bar || ?body ~= bazallowlists it. - "New test post with baz:"
Delivered because?body ~= foo || ?body ~= bar || ?body ~= bazallowlists it.
Actual outcome:
- "Test post with foo:"
Delivered because?body ~= foo || ?body ~= barallowlists it. - "Test post with bar:"
Delivered because?body ~= foo || ?body ~= barallowlists it. - "New test post with foo:"
Delivered because?body ~= foo || ?body ~= bar || ?body ~= bazallowlists it. - "New test post with bar:"
Ignored although?body ~= foo || ?body ~= bar || ?body ~= bazallowlists it. - "New test post with baz:"
Ignored although?body ~= foo || ?body ~= bar || ?body ~= bazallowlists it.
Notes
- I have tested this while having
?verb == Announcein the blocklist at the same time. - I have not tested this with AND (&&) operators.
- I have not tested this in the blocklist.
- I have not tested this with the channel-wide filter.