From a9646d217420f407280f33faf17ff164bab6beb3 Mon Sep 17 00:00:00 2001 From: IanM <16573496+imorland@users.noreply.github.com> Date: Sat, 2 Nov 2024 19:20:05 +0000 Subject: [PATCH] chore: prep for flarum/gdpr (#85) * chore: prep for flarum/gdpr * Apply fixes from StyleCI * drop php 7.3 support * optional-deps --------- Co-authored-by: StyleCI Bot --- .github/workflows/backend.yml | 1 + composer.json | 6 +++++- extend.php | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 78c7b9b..2f9fd17 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -8,5 +8,6 @@ jobs: with: enable_backend_testing: true enable_phpstan: true + php_versions: '["7.4", "8.0, "8.1", "8.2", "8.3"]' backend_directory: . diff --git a/composer.json b/composer.json index 0c9e698..39e79aa 100644 --- a/composer.json +++ b/composer.json @@ -28,6 +28,7 @@ } ], "require": { + "php": "^7.4 || ^8.0", "flarum/core": "^1.8.1", "league/oauth1-client": "^1.10.1", "league/oauth2-facebook": "^2.2.0", @@ -71,7 +72,10 @@ "name": "fas fa-sign-in-alt", "backgroundColor": "#e74c3c", "color": "#fff" - } + }, + "optional-dependencies": [ + "flarum/gdpr" + ] }, "flagrow": { "discuss": "https://discuss.flarum.org/d/25182" diff --git a/extend.php b/extend.php index c16aca0..caaa245 100644 --- a/extend.php +++ b/extend.php @@ -80,4 +80,12 @@ (new Extend\SimpleFlarumSearch(UserSearcher::class)) ->addGambit(Query\SsoIdFilterGambit::class), + + (new Extend\Conditional()) + ->whenExtensionEnabled('flarum-gdpr', fn () => [ + (new Extend\ApiSerializer(ForumSerializer::class)) + ->attribute('passwordlessSignUp', function (ForumSerializer $serializer) { + return !$serializer->getActor()->isGuest() && $serializer->getActor()->loginProviders()->count() > 0; + }), + ]), ];