From 91ce7d6f3c94fa1dce4291f4c5f97eff93020729 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Tue, 26 Sep 2023 17:55:30 +0100 Subject: [PATCH 1/4] chore: leftover gambit references on the backend --- extensions/nicknames/extend.php | 2 +- ...xtGambit.php => NicknameFullTextFilter.php} | 2 +- .../sticky/src/PinStickiedDiscussionsToTop.php | 2 +- extensions/tags/extend.php | 10 +++++----- .../src/{ => Search}/Filter/PostTagFilter.php | 2 +- .../tags/src/{ => Search}/Filter/TagFilter.php | 2 +- .../FulltextGambit.php => FulltextFilter.php} | 4 ++-- .../HideHiddenTagsFromAllDiscussionsPage.php | 2 +- .../{ => Search}/Filter/AuthorFilter.php | 2 +- .../{ => Search}/Filter/CreatedFilter.php | 2 +- .../{ => Search}/Filter/HiddenFilter.php | 2 +- .../{ => Search}/Filter/UnreadFilter.php | 2 +- .../FulltextGambit.php => FulltextFilter.php} | 4 ++-- .../core/src/Search/SearchServiceProvider.php | 18 +++++++++--------- .../User/{ => Search}/Filter/EmailFilter.php | 2 +- .../User/{ => Search}/Filter/GroupFilter.php | 2 +- .../FulltextGambit.php => FulltextFilter.php} | 4 ++-- 17 files changed, 32 insertions(+), 32 deletions(-) rename extensions/nicknames/src/{NicknameFullTextGambit.php => NicknameFullTextFilter.php} (94%) rename extensions/tags/src/{ => Search}/Filter/PostTagFilter.php (95%) rename extensions/tags/src/{ => Search}/Filter/TagFilter.php (98%) rename extensions/tags/src/Search/{Gambit/FulltextGambit.php => FulltextFilter.php} (91%) rename extensions/tags/src/{Filter => Search}/HideHiddenTagsFromAllDiscussionsPage.php (96%) rename framework/core/src/Discussion/{ => Search}/Filter/AuthorFilter.php (96%) rename framework/core/src/Discussion/{ => Search}/Filter/CreatedFilter.php (97%) rename framework/core/src/Discussion/{ => Search}/Filter/HiddenFilter.php (95%) rename framework/core/src/Discussion/{ => Search}/Filter/UnreadFilter.php (96%) rename framework/core/src/Discussion/Search/{Gambit/FulltextGambit.php => FulltextFilter.php} (96%) rename framework/core/src/User/{ => Search}/Filter/EmailFilter.php (96%) rename framework/core/src/User/{ => Search}/Filter/GroupFilter.php (97%) rename framework/core/src/User/Search/{Gambit/FulltextGambit.php => FulltextFilter.php} (91%) diff --git a/extensions/nicknames/extend.php b/extensions/nicknames/extend.php index 853499e099..32e47b08a7 100644 --- a/extensions/nicknames/extend.php +++ b/extensions/nicknames/extend.php @@ -52,7 +52,7 @@ ->configure(AddNicknameValidation::class), (new Extend\SimpleFlarumSearch(UserSearcher::class)) - ->setFullTextFilter(NicknameFullTextGambit::class), + ->setFullTextFilter(NicknameFullTextFilter::class), (new Extend\Policy()) ->modelPolicy(User::class, UserPolicy::class), diff --git a/extensions/nicknames/src/NicknameFullTextGambit.php b/extensions/nicknames/src/NicknameFullTextFilter.php similarity index 94% rename from extensions/nicknames/src/NicknameFullTextGambit.php rename to extensions/nicknames/src/NicknameFullTextFilter.php index 2dc8e3ccc4..9cea9543e4 100644 --- a/extensions/nicknames/src/NicknameFullTextGambit.php +++ b/extensions/nicknames/src/NicknameFullTextFilter.php @@ -14,7 +14,7 @@ use Flarum\User\UserRepository; use Illuminate\Database\Eloquent\Builder; -class NicknameFullTextGambit extends AbstractFulltextFilter +class NicknameFullTextFilter extends AbstractFulltextFilter { public function __construct( protected UserRepository $users diff --git a/extensions/sticky/src/PinStickiedDiscussionsToTop.php b/extensions/sticky/src/PinStickiedDiscussionsToTop.php index 3b4e3a625a..77b44d8028 100755 --- a/extensions/sticky/src/PinStickiedDiscussionsToTop.php +++ b/extensions/sticky/src/PinStickiedDiscussionsToTop.php @@ -11,7 +11,7 @@ use Flarum\Search\SearchCriteria; use Flarum\Search\SearchState; -use Flarum\Tags\Filter\TagFilter; +use Flarum\Tags\Search\Filter\TagFilter; class PinStickiedDiscussionsToTop { diff --git a/extensions/tags/extend.php b/extensions/tags/extend.php index c119b98610..35b6a17ad7 100644 --- a/extensions/tags/extend.php +++ b/extensions/tags/extend.php @@ -24,13 +24,13 @@ use Flarum\Tags\Api\Serializer\TagSerializer; use Flarum\Tags\Content; use Flarum\Tags\Event\DiscussionWasTagged; -use Flarum\Tags\Filter\HideHiddenTagsFromAllDiscussionsPage; -use Flarum\Tags\Filter\PostTagFilter; -use Flarum\Tags\Filter\TagFilter; use Flarum\Tags\Listener; use Flarum\Tags\LoadForumTagsRelationship; use Flarum\Tags\Post\DiscussionTaggedPost; -use Flarum\Tags\Search\Gambit\FulltextGambit; +use Flarum\Tags\Search\Filter\PostTagFilter; +use Flarum\Tags\Search\Filter\TagFilter; +use Flarum\Tags\Search\FulltextFilter; +use Flarum\Tags\Search\HideHiddenTagsFromAllDiscussionsPage; use Flarum\Tags\Search\TagSearcher; use Flarum\Tags\Tag; use Flarum\Tags\Utf8SlugDriver; @@ -142,7 +142,7 @@ ->addSearchMutator(HideHiddenTagsFromAllDiscussionsPage::class), (new Extend\SimpleFlarumSearch(TagSearcher::class)) - ->setFullTextFilter(FullTextGambit::class), + ->setFullTextFilter(FulltextFilter::class), (new Extend\ModelUrl(Tag::class)) ->addSlugDriver('default', Utf8SlugDriver::class), diff --git a/extensions/tags/src/Filter/PostTagFilter.php b/extensions/tags/src/Search/Filter/PostTagFilter.php similarity index 95% rename from extensions/tags/src/Filter/PostTagFilter.php rename to extensions/tags/src/Search/Filter/PostTagFilter.php index edba1ca29f..b694990398 100644 --- a/extensions/tags/src/Filter/PostTagFilter.php +++ b/extensions/tags/src/Search/Filter/PostTagFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\Tags\Filter; +namespace Flarum\Tags\Search\Filter; use Flarum\Search\FilterInterface; use Flarum\Search\SearchState; diff --git a/extensions/tags/src/Filter/TagFilter.php b/extensions/tags/src/Search/Filter/TagFilter.php similarity index 98% rename from extensions/tags/src/Filter/TagFilter.php rename to extensions/tags/src/Search/Filter/TagFilter.php index 4e6d15c374..38a6bdc3ee 100644 --- a/extensions/tags/src/Filter/TagFilter.php +++ b/extensions/tags/src/Search/Filter/TagFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\Tags\Filter; +namespace Flarum\Tags\Search\Filter; use Flarum\Http\SlugManager; use Flarum\Search\FilterInterface; diff --git a/extensions/tags/src/Search/Gambit/FulltextGambit.php b/extensions/tags/src/Search/FulltextFilter.php similarity index 91% rename from extensions/tags/src/Search/Gambit/FulltextGambit.php rename to extensions/tags/src/Search/FulltextFilter.php index 903f648c2d..af1cf2831a 100644 --- a/extensions/tags/src/Search/Gambit/FulltextGambit.php +++ b/extensions/tags/src/Search/FulltextFilter.php @@ -7,14 +7,14 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\Tags\Search\Gambit; +namespace Flarum\Tags\Search; use Flarum\Search\AbstractFulltextFilter; use Flarum\Search\SearchState; use Flarum\Tags\TagRepository; use Illuminate\Database\Eloquent\Builder; -class FulltextGambit extends AbstractFulltextFilter +class FulltextFilter extends AbstractFulltextFilter { public function __construct( protected TagRepository $tags diff --git a/extensions/tags/src/Filter/HideHiddenTagsFromAllDiscussionsPage.php b/extensions/tags/src/Search/HideHiddenTagsFromAllDiscussionsPage.php similarity index 96% rename from extensions/tags/src/Filter/HideHiddenTagsFromAllDiscussionsPage.php rename to extensions/tags/src/Search/HideHiddenTagsFromAllDiscussionsPage.php index bce8df1710..59396c2888 100644 --- a/extensions/tags/src/Filter/HideHiddenTagsFromAllDiscussionsPage.php +++ b/extensions/tags/src/Search/HideHiddenTagsFromAllDiscussionsPage.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\Tags\Filter; +namespace Flarum\Tags\Search; use Flarum\Search\SearchCriteria; use Flarum\Search\SearchState; diff --git a/framework/core/src/Discussion/Filter/AuthorFilter.php b/framework/core/src/Discussion/Search/Filter/AuthorFilter.php similarity index 96% rename from framework/core/src/Discussion/Filter/AuthorFilter.php rename to framework/core/src/Discussion/Search/Filter/AuthorFilter.php index 66adcfe709..3d77c73c48 100644 --- a/framework/core/src/Discussion/Filter/AuthorFilter.php +++ b/framework/core/src/Discussion/Search/Filter/AuthorFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\Discussion\Filter; +namespace Flarum\Discussion\Search\Filter; use Flarum\Search\FilterInterface; use Flarum\Search\SearchState; diff --git a/framework/core/src/Discussion/Filter/CreatedFilter.php b/framework/core/src/Discussion/Search/Filter/CreatedFilter.php similarity index 97% rename from framework/core/src/Discussion/Filter/CreatedFilter.php rename to framework/core/src/Discussion/Search/Filter/CreatedFilter.php index 53d242f218..3de0d6c516 100644 --- a/framework/core/src/Discussion/Filter/CreatedFilter.php +++ b/framework/core/src/Discussion/Search/Filter/CreatedFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\Discussion\Filter; +namespace Flarum\Discussion\Search\Filter; use Flarum\Search\FilterInterface; use Flarum\Search\SearchState; diff --git a/framework/core/src/Discussion/Filter/HiddenFilter.php b/framework/core/src/Discussion/Search/Filter/HiddenFilter.php similarity index 95% rename from framework/core/src/Discussion/Filter/HiddenFilter.php rename to framework/core/src/Discussion/Search/Filter/HiddenFilter.php index 85b1092084..ced42868e7 100644 --- a/framework/core/src/Discussion/Filter/HiddenFilter.php +++ b/framework/core/src/Discussion/Search/Filter/HiddenFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\Discussion\Filter; +namespace Flarum\Discussion\Search\Filter; use Flarum\Search\FilterInterface; use Flarum\Search\SearchState; diff --git a/framework/core/src/Discussion/Filter/UnreadFilter.php b/framework/core/src/Discussion/Search/Filter/UnreadFilter.php similarity index 96% rename from framework/core/src/Discussion/Filter/UnreadFilter.php rename to framework/core/src/Discussion/Search/Filter/UnreadFilter.php index 322b103721..a4b442bca7 100644 --- a/framework/core/src/Discussion/Filter/UnreadFilter.php +++ b/framework/core/src/Discussion/Search/Filter/UnreadFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\Discussion\Filter; +namespace Flarum\Discussion\Search\Filter; use Flarum\Discussion\DiscussionRepository; use Flarum\Search\FilterInterface; diff --git a/framework/core/src/Discussion/Search/Gambit/FulltextGambit.php b/framework/core/src/Discussion/Search/FulltextFilter.php similarity index 96% rename from framework/core/src/Discussion/Search/Gambit/FulltextGambit.php rename to framework/core/src/Discussion/Search/FulltextFilter.php index 72a8c4744b..3aa4850dbe 100644 --- a/framework/core/src/Discussion/Search/Gambit/FulltextGambit.php +++ b/framework/core/src/Discussion/Search/FulltextFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\Discussion\Search\Gambit; +namespace Flarum\Discussion\Search; use Flarum\Discussion\Discussion; use Flarum\Post\Post; @@ -15,7 +15,7 @@ use Flarum\Search\SearchState; use Illuminate\Database\Query\Expression; -class FulltextGambit extends AbstractFulltextFilter +class FulltextFilter extends AbstractFulltextFilter { public function search(SearchState $state, string $query): void { diff --git a/framework/core/src/Search/SearchServiceProvider.php b/framework/core/src/Search/SearchServiceProvider.php index 295d9e7acd..412dc73409 100644 --- a/framework/core/src/Search/SearchServiceProvider.php +++ b/framework/core/src/Search/SearchServiceProvider.php @@ -11,17 +11,17 @@ use Flarum\Discussion\Filter as DiscussionFilter; use Flarum\Discussion\Search\DiscussionSearcher; -use Flarum\Discussion\Search\Gambit\FulltextGambit as DiscussionFulltextFilter; +use Flarum\Discussion\Search\FulltextFilter as DiscussionFulltextFilter; use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\ContainerUtil; use Flarum\Group\Filter as GroupFilter; use Flarum\Group\Filter\GroupSearcher; -use Flarum\Http\Filter\AccessTokenSearcher; use Flarum\Http\Filter as HttpFilter; +use Flarum\Http\Filter\AccessTokenSearcher; use Flarum\Post\Filter as PostFilter; use Flarum\Post\Filter\PostSearcher; use Flarum\User\Filter as UserFilter; -use Flarum\User\Search\Gambit\FulltextGambit as UserFulltextFilter; +use Flarum\User\Search\FulltextFilter as UserFulltextFilter; use Flarum\User\Search\UserSearcher; use Illuminate\Contracts\Container\Container; use Illuminate\Support\Arr; @@ -43,14 +43,14 @@ public function register(): void HttpFilter\UserFilter::class, ], DiscussionSearcher::class => [ - DiscussionFilter\AuthorFilter::class, - DiscussionFilter\CreatedFilter::class, - DiscussionFilter\HiddenFilter::class, - DiscussionFilter\UnreadFilter::class, + \Flarum\Discussion\Search\Filter\AuthorFilter::class, + \Flarum\Discussion\Search\Filter\CreatedFilter::class, + \Flarum\Discussion\Search\Filter\HiddenFilter::class, + \Flarum\Discussion\Search\Filter\UnreadFilter::class, ], UserSearcher::class => [ - UserFilter\EmailFilter::class, - UserFilter\GroupFilter::class, + \Flarum\User\Search\Filter\EmailFilter::class, + \Flarum\User\Search\Filter\GroupFilter::class, ], GroupSearcher::class => [ GroupFilter\HiddenFilter::class, diff --git a/framework/core/src/User/Filter/EmailFilter.php b/framework/core/src/User/Search/Filter/EmailFilter.php similarity index 96% rename from framework/core/src/User/Filter/EmailFilter.php rename to framework/core/src/User/Search/Filter/EmailFilter.php index 732f0a1736..dbb9867f72 100644 --- a/framework/core/src/User/Filter/EmailFilter.php +++ b/framework/core/src/User/Search/Filter/EmailFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\User\Filter; +namespace Flarum\User\Search\Filter; use Flarum\Search\FilterInterface; use Flarum\Search\SearchState; diff --git a/framework/core/src/User/Filter/GroupFilter.php b/framework/core/src/User/Search/Filter/GroupFilter.php similarity index 97% rename from framework/core/src/User/Filter/GroupFilter.php rename to framework/core/src/User/Search/Filter/GroupFilter.php index a3dd5a5329..3d9fac9a76 100644 --- a/framework/core/src/User/Filter/GroupFilter.php +++ b/framework/core/src/User/Search/Filter/GroupFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\User\Filter; +namespace Flarum\User\Search\Filter; use Flarum\Group\Group; use Flarum\Search\FilterInterface; diff --git a/framework/core/src/User/Search/Gambit/FulltextGambit.php b/framework/core/src/User/Search/FulltextFilter.php similarity index 91% rename from framework/core/src/User/Search/Gambit/FulltextGambit.php rename to framework/core/src/User/Search/FulltextFilter.php index 5b00f2efd8..f26e8e75b3 100644 --- a/framework/core/src/User/Search/Gambit/FulltextGambit.php +++ b/framework/core/src/User/Search/FulltextFilter.php @@ -7,7 +7,7 @@ * LICENSE file that was distributed with this source code. */ -namespace Flarum\User\Search\Gambit; +namespace Flarum\User\Search; use Flarum\Search\AbstractFulltextFilter; use Flarum\Search\SearchState; @@ -15,7 +15,7 @@ use Flarum\User\UserRepository; use Illuminate\Database\Eloquent\Builder; -class FulltextGambit extends AbstractFulltextFilter +class FulltextFilter extends AbstractFulltextFilter { public function __construct( protected UserRepository $users From d2cc2cc45a9fac044ab94f6639501320e3f89586 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Tue, 26 Sep 2023 16:56:12 +0000 Subject: [PATCH 2/4] Apply fixes from StyleCI --- framework/core/src/Search/SearchServiceProvider.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/framework/core/src/Search/SearchServiceProvider.php b/framework/core/src/Search/SearchServiceProvider.php index 412dc73409..ccbbe84de6 100644 --- a/framework/core/src/Search/SearchServiceProvider.php +++ b/framework/core/src/Search/SearchServiceProvider.php @@ -9,18 +9,16 @@ namespace Flarum\Search; -use Flarum\Discussion\Filter as DiscussionFilter; use Flarum\Discussion\Search\DiscussionSearcher; use Flarum\Discussion\Search\FulltextFilter as DiscussionFulltextFilter; use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\ContainerUtil; use Flarum\Group\Filter as GroupFilter; use Flarum\Group\Filter\GroupSearcher; -use Flarum\Http\Filter as HttpFilter; use Flarum\Http\Filter\AccessTokenSearcher; +use Flarum\Http\Filter as HttpFilter; use Flarum\Post\Filter as PostFilter; use Flarum\Post\Filter\PostSearcher; -use Flarum\User\Filter as UserFilter; use Flarum\User\Search\FulltextFilter as UserFulltextFilter; use Flarum\User\Search\UserSearcher; use Illuminate\Contracts\Container\Container; From 919eafef0214683840114fef94ba2dc765916841 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Tue, 26 Sep 2023 17:58:58 +0100 Subject: [PATCH 3/4] chore: namespace --- .../core/src/Search/SearchServiceProvider.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/framework/core/src/Search/SearchServiceProvider.php b/framework/core/src/Search/SearchServiceProvider.php index ccbbe84de6..7865fa5e6a 100644 --- a/framework/core/src/Search/SearchServiceProvider.php +++ b/framework/core/src/Search/SearchServiceProvider.php @@ -9,6 +9,7 @@ namespace Flarum\Search; +use Flarum\Discussion\Search\Filter as DiscussionFilter; use Flarum\Discussion\Search\DiscussionSearcher; use Flarum\Discussion\Search\FulltextFilter as DiscussionFulltextFilter; use Flarum\Foundation\AbstractServiceProvider; @@ -19,6 +20,7 @@ use Flarum\Http\Filter as HttpFilter; use Flarum\Post\Filter as PostFilter; use Flarum\Post\Filter\PostSearcher; +use Flarum\User\Search\Filter as UserFilter; use Flarum\User\Search\FulltextFilter as UserFulltextFilter; use Flarum\User\Search\UserSearcher; use Illuminate\Contracts\Container\Container; @@ -41,14 +43,14 @@ public function register(): void HttpFilter\UserFilter::class, ], DiscussionSearcher::class => [ - \Flarum\Discussion\Search\Filter\AuthorFilter::class, - \Flarum\Discussion\Search\Filter\CreatedFilter::class, - \Flarum\Discussion\Search\Filter\HiddenFilter::class, - \Flarum\Discussion\Search\Filter\UnreadFilter::class, + DiscussionFilter\AuthorFilter::class, + DiscussionFilter\CreatedFilter::class, + DiscussionFilter\HiddenFilter::class, + DiscussionFilter\UnreadFilter::class, ], UserSearcher::class => [ - \Flarum\User\Search\Filter\EmailFilter::class, - \Flarum\User\Search\Filter\GroupFilter::class, + UserFilter\EmailFilter::class, + UserFilter\GroupFilter::class, ], GroupSearcher::class => [ GroupFilter\HiddenFilter::class, From b24c4984cfeff3b79a949b89ebfb14c9e0aeafe3 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Tue, 26 Sep 2023 16:59:57 +0000 Subject: [PATCH 4/4] Apply fixes from StyleCI --- framework/core/src/Search/SearchServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/core/src/Search/SearchServiceProvider.php b/framework/core/src/Search/SearchServiceProvider.php index 7865fa5e6a..ea9251b13b 100644 --- a/framework/core/src/Search/SearchServiceProvider.php +++ b/framework/core/src/Search/SearchServiceProvider.php @@ -9,8 +9,8 @@ namespace Flarum\Search; -use Flarum\Discussion\Search\Filter as DiscussionFilter; use Flarum\Discussion\Search\DiscussionSearcher; +use Flarum\Discussion\Search\Filter as DiscussionFilter; use Flarum\Discussion\Search\FulltextFilter as DiscussionFulltextFilter; use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\ContainerUtil;