* test: Start by adding tests for this case scenario
* fix: All discussions hidden from everyone when minSecondary > 0 and no secondary tags
* test: Test the scenario for primary tags as well
* fix: Properly fix the general case of more tags required than available
* Adjust to only check with the `viewForum` ability
* Test Cases for private discussions
This ensures that the proper tag values are returned to the API by clearing any cached tags before returning a response. It also makes sure that the listeners to the `DiscussionWasTagged` event won't have old data under `$event->discussion->tags`.
Fixes https://github.com/flarum/core/issues/2514
This doesn't fix anything, but we should explicitly only check the
permission for the ability it is meant for, just to be safe in the
future.
Also add more tests.
This allows tag scoping permissions that don't start with `discussion`, or on the contrary, removing tag scoping from permissions that DO start with `discussion`.
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
- Rename to queryIdsWhereHasPermission, since that's more accurate
- Make the base query an optional 3rd argument. This feels more intuitive
- Add a `can` function in AbstractPolicy, so extensions that add tag scopable permissions don't need to define their own policies (e.g. with approval)
- Combine ScopeDiscussionVisibilityWithAbility and ScopeDiscussionVisibility
- Fix ScopeDiscussionVisibility only requiring in one tag, not all.
- Add lots and lots of tests
Co-authored-by: SychO9 <sychocouldy@gmail.com>
- Only load lastPostedDiscussion on TagsPage
- For forum payload, only load top-level primary tags and top 3 secondary tags.
- In other cases, load tags in dynamically when needed.
Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>