Potential bug in (contact) filters regarding OR (||) chains?
So it seems that Hubzilla 10.4 has brought me closer to what I've wanted to do for years now.
I want to be able to configure filters for individual contacts in such a way that posts only come through when they contain at least one out of a number of keywords, but comments and DMs always come through.
Why? Because my channel is limited in scope and topics, and I don't want everyone and their dog to spam my stream with tons of stuff that I'm not interested in within the scope of this channel. I don't want to wade through 99% uninteresting stuff just to find the 1% interesting stuff.
So I'd write a line like this for the allow list:
?body ~= foo || ?body ~= bar || ?body ~= baz || ?item_private > 0 || ?item_thread_top == 0
In theory, I'd only see public posts from that contact that contain "foo" and/or "bar" and/or "baz", but I'd see all messages that aren't public, and I'd see all comments.
In addition, I usually filter out repeats/boosts from almost all my contacts. So the block list contains this line:
?verb == Announce
In practice, however, the allow list filter seems not to do anything. I've actually deployed filters like these (only with different keywords, of course), and it looks to me like all posts come through, regardless of whether or not one of the keywords is in them. I keep seeing public posts from filtered contacts that don't contain a single one of the keywords I've entered.
Thus, I have the suspicion that either of these does not work properly:
- Chaining multiple
?body
entries together with ||
on the allow list. - Chaining a
?body
entry and an ?item_private
entry and an ?item_thread_top
entry together with ||
on the allow list. - Chaining multiple
?body
entries and an ?item_private
entry and an ?item_thread_top
entry together with ||
on the allow list. - Same as the three above, but with an additional
?verb
entry on the block list.
Here are some test cases:
'OR connected chain: item is public, and item is not a comment, thus item is filtered out' => [
'?item_private > 0 || ?item_thread_top == 0',
'',
false
],
'OR connected chain: body does not contain any of two keywords in incl, thus item is filtered out' => [
'?body ~= rosencrantz || ?body ~= guildenstern',
'',
false
],
'OR connected chain: body does not contain keyword in incl, and item is public, and item is not a comment, thus item is filtered out' => [
'?body ~= rosencrantz || ?item_private > 0 || ?item_thread_top == 0',
'',
false
],
'OR connected chain: body does not contain any of two keywords in incl, and item is public, and item is not a comment, thus item is filtered out' => [
'?body ~= rosencrantz || ?body ~= guildenstern || ?item_private > 0 || ?item_thread_top == 0',
'',
false
],
'OR connected chain: item is public, and item is not a comment, thus item is filtered out; also, repeat in excl' => [
'?item_private > 0 || ?item_thread_top == 0',
'?verb == Announce',
false
],
'OR connected chain: body does not contain any of two keywords in incl, thus item is filtered out; also, repeat in excl' => [
'?body ~= rosencrantz || ?body ~= guildenstern',
'?verb == Announce',
false
],
'OR connected chain: body does not contain keyword in incl, and item is public, and item is not a comment, thus item is filtered out; also, repeat in excl' => [
'?body ~= rosencrantz || ?item_private > 0 || ?item_thread_top == 0',
'?verb == Announce',
false
],
'OR connected chain: body does not contain any of two keywords in incl, and item is public, and item is not a comment, thus item is filtered out; also, repeat in excl' => [
'?body ~= rosencrantz || ?body ~= guildenstern || ?item_private > 0 || ?item_thread_top == 0',
'?verb == Announce',
false
],