diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c048f9d..d7dac1c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -103,10 +103,10 @@ jobs: uses: cafuego/command-output@main with: run: | - docker-compose -f tests/docker-compose.yml up -d + docker compose -f tests/docker-compose.yml up -d sleep 10 docker ps -a - docker-compose -f tests/docker-compose.yml exec -w /srv/www -T drupal composer install + docker compose -f tests/docker-compose.yml exec -w /srv/www -T drupal composer install env: fail-fast: true @@ -115,13 +115,13 @@ jobs: uses: cafuego/command-output@main with: run: | - docker-compose -f tests/docker-compose.yml exec -w /srv/www -T drupal /usr/bin/composer run sub-theme + docker compose -f tests/docker-compose.yml exec -w /srv/www -T drupal /usr/bin/composer run sub-theme - name: PHPCS id: phpcs uses: cafuego/command-output@main with: run: | - docker-compose -f tests/docker-compose.yml exec -u appuser -w /srv/www -T drupal phpcs -p --report=full --standard=phpcs.xml ./html/modules/custom ./html/themes/custom + docker compose -f tests/docker-compose.yml exec -u appuser -w /srv/www -T drupal phpcs -p --report=full --standard=phpcs.xml ./html/modules/custom ./html/themes/custom env: fail-fast: true @@ -130,7 +130,7 @@ jobs: uses: cafuego/command-output@main with: run: | - docker-compose -f tests/docker-compose.yml exec -T drupal drush -y si --existing-config minimal install_configure_form.enable_update_status_emails=NULL + docker compose -f tests/docker-compose.yml exec -T drupal drush -y si --existing-config minimal install_configure_form.enable_update_status_emails=NULL env: fail-fast: true @@ -139,21 +139,21 @@ jobs: uses: cafuego/command-output@main with: run: | - docker-compose -f tests/docker-compose.yml exec -T drupal drush -y cset gtm_barebones.settings container_id 'GTM-ABCDEFGHIJK' - docker-compose -f tests/docker-compose.yml exec -T drupal drush -y en dblog - docker-compose -f tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/sites/default/files /srv/www/html/sites/default/private - docker-compose -f tests/docker-compose.yml exec -T drupal mkdir -p /srv/www/html/build/logs - docker-compose -f tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/build/logs - docker-compose -f tests/docker-compose.yml exec -T drupal mkdir -p /srv/www/html/sites/default/files/browser_output - docker-compose -f tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/sites/default/files/browser_output - docker-compose -f tests/docker-compose.yml exec -T -w /srv/www -e XDEBUG_MODE=coverage -e BROWSERTEST_OUTPUT_DIRECTORY=/srv/www/html/sites/default/files/browser_output -e DTT_BASE_URL=http://127.0.0.1 drupal ./vendor/bin/phpunit --coverage-clover /srv/www/html/build/logs/clover.xml --debug + docker compose -f tests/docker-compose.yml exec -T drupal drush -y cset gtm_barebones.settings container_id 'GTM-ABCDEFGHIJK' + docker compose -f tests/docker-compose.yml exec -T drupal drush -y en dblog + docker compose -f tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/sites/default/files /srv/www/html/sites/default/private + docker compose -f tests/docker-compose.yml exec -T drupal mkdir -p /srv/www/html/build/logs + docker compose -f tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/build/logs + docker compose -f tests/docker-compose.yml exec -T drupal mkdir -p /srv/www/html/sites/default/files/browser_output + docker compose -f tests/docker-compose.yml exec -T drupal chmod -R 777 /srv/www/html/sites/default/files/browser_output + docker compose -f tests/docker-compose.yml exec -T -w /srv/www -e XDEBUG_MODE=coverage -e BROWSERTEST_OUTPUT_DIRECTORY=/srv/www/html/sites/default/files/browser_output -e DTT_BASE_URL=http://127.0.0.1 drupal ./vendor/bin/phpunit --coverage-clover /srv/www/html/build/logs/clover.xml --debug env: fail-fast: true - name: Copy Coveralls id: copy_coveralls if: success() - run: docker cp "$(docker-compose -f tests/docker-compose.yml ps -q drupal)":/srv/www/html/build/logs/clover.xml . || echo "skip=true" >> "$GITHUB_OUTPUT" + run: docker cp "$(docker compose -f tests/docker-compose.yml ps -q drupal)":/srv/www/html/build/logs/clover.xml . || echo "skip=true" >> "$GITHUB_OUTPUT" - name: Monitor coverage id: coveralls @@ -173,7 +173,7 @@ jobs: uses: cafuego/command-output@main with: run: | - docker-compose -f tests/docker-compose.yml exec -T drupal drush watchdog:show + docker compose -f tests/docker-compose.yml exec -T drupal drush watchdog:show - name: Find Comment uses: peter-evans/find-comment@v2 diff --git a/PATCHES/social_auth_blocked.patch b/PATCHES/social_auth_blocked.patch new file mode 100644 index 0000000..4c38d02 --- /dev/null +++ b/PATCHES/social_auth_blocked.patch @@ -0,0 +1,13 @@ +diff --git a/src/User/UserAuthenticator.php b/src/User/UserAuthenticator.php +index 868e033..089ddef 100644 +--- a/src/User/UserAuthenticator.php ++++ b/src/User/UserAuthenticator.php +@@ -305,7 +305,7 @@ public function authenticateNewUser(UserInterface $drupal_user = NULL) { + if ($drupal_user) { + + // If the account needs admin approval. +- if ($this->isApprovalRequired()) { ++ if ($this->isApprovalRequired() && $drupal_user->isBlocked()) { + $this->messenger->addWarning($this->t("Your account was created, but it needs administrator's approval.")); + $this->nullifySessionKeys(); + diff --git a/composer.lock b/composer.lock index 22e4be0..1770c72 100644 --- a/composer.lock +++ b/composer.lock @@ -1555,30 +1555,30 @@ }, { "name": "consolidation/output-formatters", - "version": "4.3.2", + "version": "4.5.0", "source": { "type": "git", "url": "https://github.com/consolidation/output-formatters.git", - "reference": "06711568b4cd169700ff7e8075db0a9a341ceb58" + "reference": "7a611b01eb48eb19cd54672339fc08c0985bf540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/06711568b4cd169700ff7e8075db0a9a341ceb58", - "reference": "06711568b4cd169700ff7e8075db0a9a341ceb58", + "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/7a611b01eb48eb19cd54672339fc08c0985bf540", + "reference": "7a611b01eb48eb19cd54672339fc08c0985bf540", "shasum": "" }, "require": { "dflydev/dot-access-data": "^1.1.0 || ^2 || ^3", "php": ">=7.1.3", - "symfony/console": "^4 || ^5 || ^6", - "symfony/finder": "^4 || ^5 || ^6" + "symfony/console": "^4 || ^5 || ^6 || ^7", + "symfony/finder": "^4 || ^5 || ^6 || ^7" }, "require-dev": { "php-coveralls/php-coveralls": "^2.4.2", "phpunit/phpunit": "^7 || ^8 || ^9", "squizlabs/php_codesniffer": "^3", - "symfony/var-dumper": "^4 || ^5 || ^6", - "symfony/yaml": "^4 || ^5 || ^6", + "symfony/var-dumper": "^4 || ^5 || ^6 || ^7", + "symfony/yaml": "^4 || ^5 || ^6 || ^7", "yoast/phpunit-polyfills": "^1" }, "suggest": { @@ -1603,9 +1603,9 @@ "description": "Format text by applying transformations provided by plug-in formatters.", "support": { "issues": "https://github.com/consolidation/output-formatters/issues", - "source": "https://github.com/consolidation/output-formatters/tree/4.3.2" + "source": "https://github.com/consolidation/output-formatters/tree/4.5.0" }, - "time": "2023-07-06T04:45:41+00:00" + "time": "2024-04-02T15:18:52+00:00" }, { "name": "consolidation/robo", @@ -1796,16 +1796,16 @@ }, { "name": "consolidation/site-process", - "version": "5.2.0", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/consolidation/site-process.git", - "reference": "6c44638d7af8a8b4abe12c3180701243f480539d" + "reference": "5e8eff50fd0015e7ca0b6ce4082cacef012f2f77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/site-process/zipball/6c44638d7af8a8b4abe12c3180701243f480539d", - "reference": "6c44638d7af8a8b4abe12c3180701243f480539d", + "url": "https://api.github.com/repos/consolidation/site-process/zipball/5e8eff50fd0015e7ca0b6ce4082cacef012f2f77", + "reference": "5e8eff50fd0015e7ca0b6ce4082cacef012f2f77", "shasum": "" }, "require": { @@ -1847,9 +1847,9 @@ "description": "A thin wrapper around the Symfony Process Component that allows applications to use the Site Alias library to specify the target for a remote call.", "support": { "issues": "https://github.com/consolidation/site-process/issues", - "source": "https://github.com/consolidation/site-process/tree/5.2.0" + "source": "https://github.com/consolidation/site-process/tree/5.3.0" }, - "time": "2022-12-06T17:57:16+00:00" + "time": "2024-04-01T12:42:12+00:00" }, { "name": "cweagans/composer-patches", @@ -2618,7 +2618,7 @@ "shasum": "6a66e40a4249351a89afba529910e1e5e2f667aa" }, "require": { - "drupal/core": "^9.1 || ^10" + "drupal/core": "^10" }, "type": "drupal-module", "extra": { @@ -3858,7 +3858,7 @@ "shasum": "e46c24b62c3c3c6b5d7232f3b679b46b1fe0c7a9" }, "require": { - "drupal/core": "^8.8 || ^9 || ^10" + "drupal/core": "^10" }, "type": "drupal-module", "extra": { @@ -3918,7 +3918,7 @@ "shasum": "6139e7d5d5d5dd28bf51b15118c8c84d6ff91614" }, "require": { - "drupal/core": "^9 || ^10" + "drupal/core": "^10" }, "type": "drupal-module", "extra": { @@ -3970,7 +3970,7 @@ "shasum": "cc7cd2f029137e99a99deb90aee83b8bbf01c0d4" }, "require": { - "drupal/core": "^8 || ^9 || ^10", + "drupal/core": "^10", "drupal/imageapi_optimize": "*" }, "type": "drupal-module", @@ -10067,16 +10067,16 @@ }, { "name": "psy/psysh", - "version": "v0.12.2", + "version": "v0.12.3", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "9185c66c2165bbf4d71de78a69dccf4974f9538d" + "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/9185c66c2165bbf4d71de78a69dccf4974f9538d", - "reference": "9185c66c2165bbf4d71de78a69dccf4974f9538d", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", + "reference": "b6b6cce7d3ee8fbf31843edce5e8f5a72eff4a73", "shasum": "" }, "require": { @@ -10140,9 +10140,9 @@ ], "support": { "issues": "https://github.com/bobthecow/psysh/issues", - "source": "https://github.com/bobthecow/psysh/tree/v0.12.2" + "source": "https://github.com/bobthecow/psysh/tree/v0.12.3" }, - "time": "2024-03-17T01:53:00+00:00" + "time": "2024-04-02T15:57:53+00:00" }, { "name": "ralouphie/getallheaders", @@ -16009,16 +16009,16 @@ }, { "name": "symfony/config", - "version": "v7.0.4", + "version": "v7.0.6", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "44deeba7233f08f383185ffa37dace3b3bc87364" + "reference": "7fc7e18a73ec8125fd95928c0340470d64760deb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/44deeba7233f08f383185ffa37dace3b3bc87364", - "reference": "44deeba7233f08f383185ffa37dace3b3bc87364", + "url": "https://api.github.com/repos/symfony/config/zipball/7fc7e18a73ec8125fd95928c0340470d64760deb", + "reference": "7fc7e18a73ec8125fd95928c0340470d64760deb", "shasum": "" }, "require": { @@ -16064,7 +16064,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v7.0.4" + "source": "https://github.com/symfony/config/tree/v7.0.6" }, "funding": [ { @@ -16080,7 +16080,7 @@ "type": "tidelift" } ], - "time": "2024-02-26T07:52:39+00:00" + "time": "2024-03-27T19:55:25+00:00" }, { "name": "weitzman/drupal-test-traits", @@ -16144,5 +16144,5 @@ "php": ">=8.1" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/composer.patches.json b/composer.patches.json index a34deed..4590bbe 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -6,6 +6,9 @@ "drupal/csp": { "Simplify log format": "PATCHES/csp-log-format.patch" }, + "drupal/social_auth": { + "Allow activate on users": "PATCHES/social_auth_blocked.patch" + }, "drupal/user_expire": { "Allow the notification email to be customised": "PATCHES/user_expire-customize-notification-email.patch", "Reset expiration when user is reactivated": "PATCHES/user_expire-reset-expiration-on-reactivation.patch" diff --git a/html/modules/custom/ocha_ai_summarize/ocha_ai_summarize.module b/html/modules/custom/ocha_ai_summarize/ocha_ai_summarize.module index f85cbdc..0b73025 100644 --- a/html/modules/custom/ocha_ai_summarize/ocha_ai_summarize.module +++ b/html/modules/custom/ocha_ai_summarize/ocha_ai_summarize.module @@ -1387,10 +1387,20 @@ function ocha_ai_summarize_user_presave(UserInterface $user) { $user->setUsername($user->getInitialEmail()); $user->activate(); $user->addRole('document_analyzer'); + } +} - \Drupal::messenger()->deleteAll(); - \Drupal::messenger()->addMessage(t('Your account has been automatically approved, you can now log in.')); +/** + * Implements hook_ENTITY_TYPE_insert(). + */ +function ocha_ai_summarize_user_insert(UserInterface $user) { + $parts = explode('@', $user->getInitialEmail()); + if ($parts[1] != 'un.org') { + return; } + + \Drupal::messenger()->deleteAll(); + \Drupal::messenger()->addMessage(t('Your account has been automatically approved.')); } /** @@ -1415,7 +1425,7 @@ function ocha_ai_summarize_notify_user(NodeInterface $node) { $mail_manager = \Drupal::service('plugin.manager.mail'); $module = 'ocha_ai_summarize'; $key = 'notify_user'; - $to = $node->getOwner()->getInitialEmail(); + $to = $node->getOwner()->getEmail(); $langcode = $node->getOwner()->getPreferredLangcode(); $params['subject'] = t('AI Summarize: your document has been processed.'); @@ -1423,7 +1433,7 @@ function ocha_ai_summarize_notify_user(NodeInterface $node) { t('Dear'), t('Your document has been processed.'), t('You can see the result on @link', [ - '@link' => $node->toUrl('absolute')->toString(), + '@link' => $node->toUrl('absolute')->setAbsolute()->toString(), ]), ]); diff --git a/html/themes/custom/common_design_subtheme/package-lock.json b/html/themes/custom/common_design_subtheme/package-lock.json index 93c5f76..add0b55 100644 --- a/html/themes/custom/common_design_subtheme/package-lock.json +++ b/html/themes/custom/common_design_subtheme/package-lock.json @@ -4295,9 +4295,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "dev": true, "funding": [ { diff --git a/tests/test.sh b/tests/test.sh index 1b89c80..4c574a9 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -8,7 +8,7 @@ make # Create the site, memcache and mysql containers. echo "Create the site, memcache and mysql containers." -docker-compose -p ai-summarize-test -f tests/docker-compose.yml up -d +docker compose -p ai-summarize-test -f tests/docker-compose.yml up -d # Dump some information about the created containers. echo "Dump some information about the created containers." @@ -51,4 +51,4 @@ docker exec -it -u root -w /srv/www -e XDEBUG_MODE=coverage -e BROWSERTEST_OUTPU # Remove the image. echo "Remove the test image" -docker-compose -p ai-summarize-test -f tests/docker-compose.yml down -v +docker compose -p ai-summarize-test -f tests/docker-compose.yml down -v