Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a default filter to discussions breaks a few things #3644

Open
iPurpl3x opened this issue Sep 16, 2022 · 2 comments
Open

Adding a default filter to discussions breaks a few things #3644

iPurpl3x opened this issue Sep 16, 2022 · 2 comments
Labels

Comments

@iPurpl3x
Copy link
Contributor

iPurpl3x commented Sep 16, 2022

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" 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...

Steps to Reproduce

  1. Add a filter with an extension
  2. Make that this filter is active by default
  3. See broken sticky and tags behaviour

Expected Behavior

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.

@SychO9
Copy link
Member

SychO9 commented Nov 5, 2023

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?

@iPurpl3x
Copy link
Contributor Author

iPurpl3x commented Nov 7, 2023

@SychO9 an example would be fof/discussion-language. Depending on the settings, there are cases where the discussions are filtered by the user language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants