2 Advanced Content Filter addon
Hypolite Petovan edited this page 2018-10-11 10:52:09 -04:00

The Advanced Content Filter addon enables users to collapse posts in their network stream according to customized rules based on the raw item data.

A few real life examples

1. Collapse all posts containing at least an image

body matches "/\\[img/"

Pictures are nice, I'm fine to see them after a click to save space in my stream. I wrote the regular expression pattern without the closing bracket, because some the image tag can be used on its own [img] or with a dimension parameter [img=480x640].

2. Collapse reshares by specific contacts

author_link matches "/<name>/" && body matches "/\\[share author=/"

This rule combines two conditions with the logical operator AND - this means that the second condition will only be evaluated if the first one is true. With author_link the rule checks for users with the string cat_alina in their profile URL and if it happens, then the second part will check the item body for the string [share author= which appears only in reshared items.

3. Collapse posts from inoffiziell or unofficial news accounts

author_name matches "/[ui]noffi(ziell|cial)/i" || body matches "/\\[share author=.*[ui]noffi(cial|ziell)/i"

I want to filter all those news pages and luckily a lot of them contain the word inoffiziell or unofficial in their display name. So I search for (inoffiziell|unofficial) in the author display name OR (logical or) for (inoffiziell|unofficial) as attribute in [share author= to also catch reshared items. My regular expression [ui]noffi(ziell|cial) is a shorter version of (inoffiziell|unofficial) and the i after the second backslash indicates the pattern is case insensitive, which means it will match Inoffiziell or even UNOFFICIAL.

4. Collapse all posts not from a specific account

author_link != 'https://friendica.example.tld/profile/username' && body matches "/blubb/"

This rule matches items that have the word blubb in their body and which were not published by the profile https://friendica.example.tld/profile/username. Remember that equality operators == and != match the exact string against the provided item property, while matches that can match a portion of the item property.