Open clarkwinkelmann opened 3 years ago
The proposed solution makes sense to me. I'd want to see some integration tests for it though when we go to implement.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We do this to keep the amount of open issues to a manageable minimum. In any case, thanks for taking an interest in this software and contributing by opening the issue in the first place!
Haven't tested, but I suspect that https://github.com/flarum/tags/pull/128 might have helped here. If not, should be a relatively easy fix: we'd just need to add an else
case to https://github.com/flarum/tags/blob/6a4e9d10971c5230e4d0a53a8b1a294802eb962c/src/Access/ScopeDiscussionVisibilityForAbility.php#L64-L66
I can confirm the problem still exists on Flarum 1.0.4 and 1.1.0
There's another problem that's probably related to this as well.
If I give the permissions like this:
Then a discussion with both Tag 1 and Tag 2 is also not matched by the query scope when using the non-admin privilege group as actor :thinking:
I'll try to come up with a set of unit tests for this if I find some time.
Bug Report
Current Behavior Using a custom scope like
$discussionEloquentQuery->whereVisibleTo($actor, 'seeMyThing')
with the intent for Tags to automatically scope it based ondiscussion.seeMyThing
permission results in discussions with no tags not being returned, even if the global setting allows it.Steps to Reproduce
discussion.seeMyThing
$discussionEloquentQuery->whereVisibleTo($actor, 'seeMyThing')
on a discussion query builder, for exampleDiscussion::query()->whereVisibleTo($actor, 'seeMyThing')->get()
$actor
guest or adminExpected Behavior Discussions with no tags should be returned by Tag's
ScopeDiscussionVisibilityForAbility
when the global permission allows it.Environment
Possible Solution
The fix will probably need to be done in https://github.com/flarum/tags/blob/master/src/Access/ScopeDiscussionVisibilityForAbility.php
Maybe something like this (untested)
Additional Context Affects https://github.com/clarkwinkelmann/flarum-ext-see-past-first-post
Not sure if the problem was already present in beta 13 or not.