You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding a filter to the api/discussions endpoint that is activated by default (including when on /all and with default sort), then things like "Hide from All Discussions" in flarum/tags or the entire flarum/sticky logic just get ignored because there is an active filter.
I suppose the code that has been written makes sense because in most cases when you are on /all and have the default sort selected, there are no filters active. But in my use-case there is, so those extensions (tags & sticky) are broken. Maybe there are other things that are broken as well that I am not yet aware of...
As a reference, here are the lines of code that are making things break, because they are hard-coded to check if there is an active filter, and if there is the rest of the logic is skipped...
Tags and Sticky should work if there is a filter activated by default
Environment
Flarum version: 1.5.0
PHP version: 8.0.x
Possible Solution
A possible solution could be to add an extender that allows extensions to blacklist their filters so that they don't get counted when checking if there are active filters.
The text was updated successfully, but these errors were encountered:
can you please give an example use case for such a filter?
I'm thinking if a filter is meant to always be applied, why not make it a mutator instead? Or how do you decide when it is and isn't applied?
@SychO9 an example would be fof/discussion-language. Depending on the settings, there are cases where the discussions are filtered by the user language.
Current Behavior
When adding a filter to the
api/discussions
endpoint that is activated by default (including when on/all
and with default sort), then things like "Hide from All Discussions" inflarum/tags
or the entireflarum/sticky
logic just get ignored because there is an active filter.I suppose the code that has been written makes sense because in most cases when you are on
/all
and have the default sort selected, there are no filters active. But in my use-case there is, so those extensions (tags & sticky) are broken. Maybe there are other things that are broken as well that I am not yet aware of...As a reference, here are the lines of code that are making things break, because they are hard-coded to check if there is an active filter, and if there is the rest of the logic is skipped...
framework/extensions/sticky/src/PinStickiedDiscussionsToTop.php
Line 27 in 05f80b7
framework/extensions/tags/src/Filter/HideHiddenTagsFromAllDiscussionsPage.php
Line 20 in 379c063
Steps to Reproduce
Expected Behavior
Tags and Sticky should work if there is a filter activated by default
Environment
Possible Solution
A possible solution could be to add an extender that allows extensions to blacklist their filters so that they don't get counted when checking if there are active filters.
The text was updated successfully, but these errors were encountered: