From bf5a401787910f74461728b747edda314094c336 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Tue, 11 May 2021 20:10:10 -0400 Subject: [PATCH] Remove flags visibility scoping This was moved to flags in https://github.com/flarum/flags/commit/9fe9dd515bae7b4377fe0dd1f3a81cf6d41d857e --- extensions/tags/extend.php | 3 -- .../tags/src/Access/ScopeFlagVisibility.php | 37 ------------------- 2 files changed, 40 deletions(-) delete mode 100644 extensions/tags/src/Access/ScopeFlagVisibility.php diff --git a/extensions/tags/extend.php b/extensions/tags/extend.php index cead40942..1cc15c8fa 100644 --- a/extensions/tags/extend.php +++ b/extensions/tags/extend.php @@ -98,9 +98,6 @@ return [ (new Extend\ModelVisibility(Discussion::class)) ->scopeAll(Access\ScopeDiscussionVisibilityForAbility::class), - (new Extend\ModelVisibility(Flag::class)) - ->scope(Access\ScopeFlagVisibility::class), - (new Extend\ModelVisibility(Tag::class)) ->scope(Access\ScopeTagVisibility::class), diff --git a/extensions/tags/src/Access/ScopeFlagVisibility.php b/extensions/tags/src/Access/ScopeFlagVisibility.php deleted file mode 100644 index b926fff5e..000000000 --- a/extensions/tags/src/Access/ScopeFlagVisibility.php +++ /dev/null @@ -1,37 +0,0 @@ -select('flags.*') - ->leftJoin('posts', 'posts.id', '=', 'flags.post_id') - ->leftJoin('discussions', 'discussions.id', '=', 'posts.discussion_id') - ->whereNotExists(function ($query) use ($actor) { - return $query->selectRaw('1') - ->from('discussion_tag') - ->whereNotIn('tag_id', function ($query) use ($actor) { - Tag::query()->setQuery($query->from('tags'))->whereHasPermission($actor, 'viewFlags')->select('tags.id'); - }) - ->whereColumn('discussions.id', 'discussion_id'); - }); - } -}