diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 975c3a4e2..0684d88d2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,4 +65,4 @@ jobs: - name: Run PHPUnit tests run: | composer test-php public/modules/custom - [ -d "tests/" ] && composer test-php tests/ || echo "No DTT tests found. Ignoring..." + if [ -d "tests/" ]; then composer test-php tests/; else echo "No DTT tests found. Ignoring..."; fi diff --git a/composer.json b/composer.json index be20869ba..0ecb8ddc0 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "drupal/helfi_navigation": "^2.0", "drupal/helfi_platform_config": "^3.0", "drupal/helfi_proxy": "^3.0", - "drupal/helfi_tunnistamo": "^2.0", + "drupal/helfi_tunnistamo": "^3.0", "drupal/json_field": "^1.0@RC", "drupal/jsonapi_extras": "^3.20", "drupal/jsonapi_menu_items": "^1.2", diff --git a/composer.lock b/composer.lock index 72e834663..0fe400fc7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "38a5de68ca127fbad511d10cc554fd4b", + "content-hash": "5980295a9b1b026de91a603c8116697c", "packages": [ { "name": "asm89/stack-cors", @@ -2136,16 +2136,16 @@ }, { "name": "drupal/core", - "version": "9.5.10", + "version": "9.5.11", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "c84bab7403943fbc4ed90ffcdde4460a94642b06" + "reference": "8afcb233c2a71501b35fed2713167c37831d5c19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/c84bab7403943fbc4ed90ffcdde4460a94642b06", - "reference": "c84bab7403943fbc4ed90ffcdde4460a94642b06", + "url": "https://api.github.com/repos/drupal/core/zipball/8afcb233c2a71501b35fed2713167c37831d5c19", + "reference": "8afcb233c2a71501b35fed2713167c37831d5c19", "shasum": "" }, "require": { @@ -2297,9 +2297,9 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/9.5.10" + "source": "https://github.com/drupal/core/tree/9.5.11" }, - "time": "2023-07-05T09:26:59+00:00" + "time": "2023-09-19T17:58:28+00:00" }, { "name": "drupal/core-composer-scaffold", @@ -3927,16 +3927,16 @@ }, { "name": "drupal/hdbt", - "version": "5.6.1", + "version": "5.6.12", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-hdbt.git", - "reference": "d4eeff38bc61f431613c8fa9a4d92a8755f66b09" + "reference": "c24eecd637d0373f9da2bcc01336feee376fcaf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-hdbt/zipball/d4eeff38bc61f431613c8fa9a4d92a8755f66b09", - "reference": "d4eeff38bc61f431613c8fa9a4d92a8755f66b09", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-hdbt/zipball/c24eecd637d0373f9da2bcc01336feee376fcaf1", + "reference": "c24eecd637d0373f9da2bcc01336feee376fcaf1", "shasum": "" }, "require": { @@ -3954,10 +3954,10 @@ "Drupal" ], "support": { - "source": "https://github.com/City-of-Helsinki/drupal-hdbt/tree/5.6.1", + "source": "https://github.com/City-of-Helsinki/drupal-hdbt/tree/5.6.12", "issues": "https://github.com/City-of-Helsinki/drupal-hdbt/issues" }, - "time": "2023-09-11T12:42:43+00:00" + "time": "2023-09-26T09:47:13+00:00" }, { "name": "drupal/hdbt_admin", @@ -4046,16 +4046,16 @@ }, { "name": "drupal/helfi_api_base", - "version": "2.5.3", + "version": "2.5.5", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-module-helfi-api-base.git", - "reference": "f5fab16526d75c612e420a68ebe933efb5c72a0e" + "reference": "7ffd5b029f1d85590dc8966007f3936f14cb3c35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-api-base/zipball/f5fab16526d75c612e420a68ebe933efb5c72a0e", - "reference": "f5fab16526d75c612e420a68ebe933efb5c72a0e", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-api-base/zipball/7ffd5b029f1d85590dc8966007f3936f14cb3c35", + "reference": "7ffd5b029f1d85590dc8966007f3936f14cb3c35", "shasum": "" }, "require": { @@ -4081,10 +4081,10 @@ ], "description": "Helfi - API Base", "support": { - "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/tree/2.5.3", + "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/tree/2.5.5", "issues": "https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/issues" }, - "time": "2023-09-13T05:29:57+00:00" + "time": "2023-09-18T06:55:18+00:00" }, { "name": "drupal/helfi_azure_fs", @@ -4131,12 +4131,12 @@ "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-tools.git", - "reference": "0ebc9e72b92b37fa37bd3eb003c4f4d0db329bfa" + "reference": "8dfd9dda99f0934070119547e7f950d3f90a9ebc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-tools/zipball/0ebc9e72b92b37fa37bd3eb003c4f4d0db329bfa", - "reference": "0ebc9e72b92b37fa37bd3eb003c4f4d0db329bfa", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-tools/zipball/8dfd9dda99f0934070119547e7f950d3f90a9ebc", + "reference": "8dfd9dda99f0934070119547e7f950d3f90a9ebc", "shasum": "" }, "default-branch": true, @@ -4149,20 +4149,20 @@ "source": "https://github.com/City-of-Helsinki/drupal-tools/tree/main", "issues": "https://github.com/City-of-Helsinki/drupal-tools/issues" }, - "time": "2023-09-06T06:27:11+00:00" + "time": "2023-09-26T09:45:28+00:00" }, { "name": "drupal/helfi_navigation", - "version": "2.0.13", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-module-helfi-navigation.git", - "reference": "c2497e87c7b4242354c323aad5c21ec09e37d3a7" + "reference": "5c0f648a21220a6e8b6c14543f8e60b4b843a918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-navigation/zipball/c2497e87c7b4242354c323aad5c21ec09e37d3a7", - "reference": "c2497e87c7b4242354c323aad5c21ec09e37d3a7", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-navigation/zipball/5c0f648a21220a6e8b6c14543f8e60b4b843a918", + "reference": "5c0f648a21220a6e8b6c14543f8e60b4b843a918", "shasum": "" }, "require": { @@ -4180,23 +4180,23 @@ ], "description": "Helfi - Navigation", "support": { - "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-navigation/tree/2.0.13", + "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-navigation/tree/2.1.1", "issues": "https://github.com/City-of-Helsinki/drupal-module-helfi-navigation/issues" }, - "time": "2023-09-13T05:51:44+00:00" + "time": "2023-09-21T08:34:22+00:00" }, { "name": "drupal/helfi_platform_config", - "version": "3.4.5", + "version": "3.4.17", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config.git", - "reference": "90394a0feab45409ed2c2101ef3d48c02906714e" + "reference": "46244701cdef62af87c7e376b4e43391ee6c870c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-helfi-platform-config/zipball/90394a0feab45409ed2c2101ef3d48c02906714e", - "reference": "90394a0feab45409ed2c2101ef3d48c02906714e", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-helfi-platform-config/zipball/46244701cdef62af87c7e376b4e43391ee6c870c", + "reference": "46244701cdef62af87c7e376b4e43391ee6c870c", "shasum": "" }, "require": { @@ -4299,10 +4299,10 @@ ], "description": "HELfi platform config", "support": { - "source": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/tree/3.4.5", + "source": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/tree/3.4.17", "issues": "https://github.com/City-of-Helsinki/drupal-helfi-platform-config/issues" }, - "time": "2023-09-13T06:57:57+00:00" + "time": "2023-09-27T08:15:04+00:00" }, { "name": "drupal/helfi_proxy", @@ -4350,16 +4350,16 @@ }, { "name": "drupal/helfi_tpr", - "version": "2.2.6", + "version": "2.2.7", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-module-helfi-tpr.git", - "reference": "f73c27c4d30522303dfadf1228c7331e120f04ac" + "reference": "68a4e65acffc2038e5006f1d4b2763bc52017184" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-tpr/zipball/f73c27c4d30522303dfadf1228c7331e120f04ac", - "reference": "f73c27c4d30522303dfadf1228c7331e120f04ac", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-tpr/zipball/68a4e65acffc2038e5006f1d4b2763bc52017184", + "reference": "68a4e65acffc2038e5006f1d4b2763bc52017184", "shasum": "" }, "require": { @@ -4385,23 +4385,23 @@ ], "description": "TPR integration", "support": { - "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-tpr/tree/2.2.6", + "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-tpr/tree/2.2.7", "issues": "https://github.com/City-of-Helsinki/drupal-module-helfi-tpr/issues" }, - "time": "2023-09-01T12:09:30+00:00" + "time": "2023-09-14T11:48:29+00:00" }, { "name": "drupal/helfi_tunnistamo", - "version": "2.2.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/City-of-Helsinki/drupal-module-helfi-tunnistamo.git", - "reference": "17badf64ebfcc6a30458634b19a4387cb4ce3d34" + "reference": "29e98d8a1c9fd39a98da7ce2b44fdc28a614bd99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-tunnistamo/zipball/17badf64ebfcc6a30458634b19a4387cb4ce3d34", - "reference": "17badf64ebfcc6a30458634b19a4387cb4ce3d34", + "url": "https://api.github.com/repos/City-of-Helsinki/drupal-module-helfi-tunnistamo/zipball/29e98d8a1c9fd39a98da7ce2b44fdc28a614bd99", + "reference": "29e98d8a1c9fd39a98da7ce2b44fdc28a614bd99", "shasum": "" }, "require": { @@ -4418,10 +4418,10 @@ ], "description": "Tunnistamo integration", "support": { - "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-tunnistamo/tree/2.2.4", + "source": "https://github.com/City-of-Helsinki/drupal-module-helfi-tunnistamo/tree/3.0.0", "issues": "https://github.com/City-of-Helsinki/drupal-module-helfi-tunnistamo/issues" }, - "time": "2023-05-17T11:53:24+00:00" + "time": "2023-08-28T07:28:23+00:00" }, { "name": "drupal/image_style_quality", @@ -9216,30 +9216,30 @@ }, { "name": "laminas/laminas-stdlib", - "version": "3.17.0", + "version": "3.18.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-stdlib.git", - "reference": "dd35c868075bad80b6718959740913e178eb4274" + "reference": "e85b29076c6216e7fc98e72b42dbe1bbc3b95ecf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/dd35c868075bad80b6718959740913e178eb4274", - "reference": "dd35c868075bad80b6718959740913e178eb4274", + "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/e85b29076c6216e7fc98e72b42dbe1bbc3b95ecf", + "reference": "e85b29076c6216e7fc98e72b42dbe1bbc3b95ecf", "shasum": "" }, "require": { - "php": "~8.1.0 || ~8.2.0" + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" }, "conflict": { "zendframework/zend-stdlib": "*" }, "require-dev": { "laminas/laminas-coding-standard": "^2.5", - "phpbench/phpbench": "^1.2.9", - "phpunit/phpunit": "^10.0.16", + "phpbench/phpbench": "^1.2.14", + "phpunit/phpunit": "^10.3.3", "psalm/plugin-phpunit": "^0.18.4", - "vimeo/psalm": "^5.8" + "vimeo/psalm": "^5.15.0" }, "type": "library", "autoload": { @@ -9271,7 +9271,7 @@ "type": "community_bridge" } ], - "time": "2023-03-20T13:51:37+00:00" + "time": "2023-09-19T10:15:21+00:00" }, { "name": "league/container", @@ -11169,16 +11169,16 @@ }, { "name": "psr/http-client", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/php-fig/http-client.git", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31" + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/0955afe48220520692d2d09f7ab7e0f93ffd6a31", - "reference": "0955afe48220520692d2d09f7ab7e0f93ffd6a31", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", "shasum": "" }, "require": { @@ -11215,9 +11215,9 @@ "psr-18" ], "support": { - "source": "https://github.com/php-fig/http-client/tree/1.0.2" + "source": "https://github.com/php-fig/http-client" }, - "time": "2023-04-10T20:12:12+00:00" + "time": "2023-09-23T14:17:50+00:00" }, { "name": "psr/http-factory", @@ -16972,16 +16972,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.24.0", + "version": "1.24.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6" + "reference": "bcad8d995980440892759db0c32acae7c8e79442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/3510b0a6274cc42f7219367cb3abfc123ffa09d6", - "reference": "3510b0a6274cc42f7219367cb3abfc123ffa09d6", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442", + "reference": "bcad8d995980440892759db0c32acae7c8e79442", "shasum": "" }, "require": { @@ -17013,9 +17013,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2" }, - "time": "2023-09-07T20:46:32+00:00" + "time": "2023-09-26T12:28:12+00:00" }, { "name": "phpstan/phpstan", diff --git a/conf/cmi/core.base_field_override.node.announcement.title.yml b/conf/cmi/core.base_field_override.node.announcement.title.yml new file mode 100644 index 000000000..5eda24a99 --- /dev/null +++ b/conf/cmi/core.base_field_override.node.announcement.title.yml @@ -0,0 +1,20 @@ +uuid: 049b3dd7-afc2-481f-b648-3869d01e681e +langcode: en +status: true +dependencies: + config: + - node.type.announcement +_core: + default_config_hash: v0rg9ztfYRnKz2PXAcGD_Q52rTcPbwqaZLw3tXWd4rM +id: node.announcement.title +field_name: title +entity_type: node +bundle: announcement +label: 'Administrative title' +description: '' +required: true +translatable: true +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/conf/cmi/core.entity_form_display.node.announcement.default.yml b/conf/cmi/core.entity_form_display.node.announcement.default.yml index 9ae76b692..0cc1059bd 100644 --- a/conf/cmi/core.entity_form_display.node.announcement.default.yml +++ b/conf/cmi/core.entity_form_display.node.announcement.default.yml @@ -7,6 +7,7 @@ dependencies: - field.field.node.announcement.field_announcement_all_pages - field.field.node.announcement.field_announcement_content_pages - field.field.node.announcement.field_announcement_link + - field.field.node.announcement.field_announcement_title - field.field.node.announcement.field_announcement_type - field.field.node.announcement.field_publish_externally - node.type.announcement @@ -19,7 +20,7 @@ dependencies: - select2 - text _core: - default_config_hash: le2Wzlas0qZ9Bj-o6WlJbHDeisFrucs9F4B3VOK8t_w + default_config_hash: 0ewsu2ZhpNhAo4t7wkUgEa9ABQAkcsF7IXtR-kFeDUg id: node.announcement.default targetEntityType: node bundle: announcement @@ -27,7 +28,7 @@ mode: default content: body: type: text_textarea_with_summary - weight: 15 + weight: 17 region: content settings: rows: 9 @@ -43,14 +44,14 @@ content: third_party_settings: { } field_announcement_all_pages: type: boolean_checkbox - weight: 11 + weight: 13 region: content settings: display_label: true third_party_settings: { } field_announcement_content_pages: type: select2_entity_reference - weight: 12 + weight: 15 region: content settings: width: 100% @@ -60,7 +61,7 @@ content: third_party_settings: { } field_announcement_link: type: link_default - weight: 16 + weight: 18 region: content settings: placeholder_url: '' @@ -68,7 +69,7 @@ content: third_party_settings: { } field_announcement_service_pages: type: select2_entity_reference - weight: 14 + weight: 16 region: content settings: width: 100% @@ -76,16 +77,24 @@ content: match_operator: CONTAINS match_limit: 20 third_party_settings: { } + field_announcement_title: + type: string_textfield + weight: 16 + region: content + settings: + size: 60 + placeholder: '' + third_party_settings: { } field_announcement_type: type: select2 - weight: 10 + weight: 11 region: content settings: width: 100% third_party_settings: { } field_announcement_unit_pages: type: select2_entity_reference - weight: 13 + weight: 15 region: content settings: width: 100% @@ -93,6 +102,13 @@ content: match_operator: CONTAINS match_limit: 20 third_party_settings: { } + field_publish_externally: + type: boolean_checkbox + weight: 14 + region: content + settings: + display_label: true + third_party_settings: { } langcode: type: language_select weight: 1 @@ -124,7 +140,7 @@ content: settings: { } third_party_settings: { } simple_sitemap: - weight: 10 + weight: 12 region: content settings: { } third_party_settings: { } @@ -165,7 +181,6 @@ content: settings: { } third_party_settings: { } hidden: - field_publish_externally: true hide_sidebar_navigation: true promote: true sticky: true diff --git a/conf/cmi/core.entity_view_display.node.announcement.default.yml b/conf/cmi/core.entity_view_display.node.announcement.default.yml index 7d7737670..a6b8a05ce 100644 --- a/conf/cmi/core.entity_view_display.node.announcement.default.yml +++ b/conf/cmi/core.entity_view_display.node.announcement.default.yml @@ -7,6 +7,7 @@ dependencies: - field.field.node.announcement.field_announcement_all_pages - field.field.node.announcement.field_announcement_content_pages - field.field.node.announcement.field_announcement_link + - field.field.node.announcement.field_announcement_title - field.field.node.announcement.field_announcement_type - field.field.node.announcement.field_publish_externally - node.type.announcement @@ -16,7 +17,7 @@ dependencies: - text - user _core: - default_config_hash: IHF-sP4Gq6tdTyWDxQDDEdLbHz3-QzklMNE1QA2mQU0 + default_config_hash: LQ9K_wCbd758UCcNEORQvFUQ7gNJddkukiwwYHrZv4c id: node.announcement.default targetEntityType: node bundle: announcement @@ -41,6 +42,14 @@ content: third_party_settings: { } weight: 3 region: content + field_announcement_title: + type: string + label: hidden + settings: + link_to_entity: false + third_party_settings: { } + weight: 4 + region: content field_announcement_type: type: list_default label: hidden diff --git a/conf/cmi/core.entity_view_display.node.announcement.teaser.yml b/conf/cmi/core.entity_view_display.node.announcement.teaser.yml index 819c4997a..e3bc62941 100644 --- a/conf/cmi/core.entity_view_display.node.announcement.teaser.yml +++ b/conf/cmi/core.entity_view_display.node.announcement.teaser.yml @@ -8,6 +8,7 @@ dependencies: - field.field.node.announcement.field_announcement_all_pages - field.field.node.announcement.field_announcement_content_pages - field.field.node.announcement.field_announcement_link + - field.field.node.announcement.field_announcement_title - field.field.node.announcement.field_announcement_type - field.field.node.announcement.field_publish_externally - node.type.announcement @@ -15,7 +16,7 @@ dependencies: - text - user _core: - default_config_hash: FhIJpRvY90w782EYtR2V2Yfppyglwp191xkVdXEEbbM + default_config_hash: OwH532HYBVjDOUW0iJnoDWc2yFGZwwGJnAZEmZPjLCA id: node.announcement.teaser targetEntityType: node bundle: announcement @@ -39,6 +40,7 @@ hidden: field_announcement_content_pages: true field_announcement_link: true field_announcement_service_pages: true + field_announcement_title: true field_announcement_type: true field_announcement_unit_pages: true field_publish_externally: true diff --git a/conf/cmi/field.field.node.announcement.field_announcement_title.yml b/conf/cmi/field.field.node.announcement.field_announcement_title.yml new file mode 100644 index 000000000..940e46b32 --- /dev/null +++ b/conf/cmi/field.field.node.announcement.field_announcement_title.yml @@ -0,0 +1,21 @@ +uuid: ed800b6e-cbe6-473b-a8af-cb545a8a4481 +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_announcement_title + - node.type.announcement +_core: + default_config_hash: f0piVjyoLRnZfc5fbRP6BdQ6_iMw7az35Req0V6Z4mg +id: node.announcement.field_announcement_title +field_name: field_announcement_title +entity_type: node +bundle: announcement +label: 'Announcement title' +description: 'This title is only available to users of assistive technology. ' +required: true +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/conf/cmi/field.storage.node.field_announcement_title.yml b/conf/cmi/field.storage.node.field_announcement_title.yml new file mode 100644 index 000000000..4ba43b98a --- /dev/null +++ b/conf/cmi/field.storage.node.field_announcement_title.yml @@ -0,0 +1,23 @@ +uuid: f3e37f50-b1d1-4861-b867-065f9b5e66ad +langcode: en +status: true +dependencies: + module: + - node +_core: + default_config_hash: dDVMTZxf5aD5P9HjLJX_6ThWFSclPORpZMThR3dd_XY +id: node.field_announcement_title +field_name: field_announcement_title +entity_type: node +type: string +settings: + max_length: 255 + case_sensitive: false + is_ascii: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/conf/cmi/helfi_api_base.delete_revisions.yml b/conf/cmi/helfi_api_base.delete_revisions.yml new file mode 100644 index 000000000..6955f6676 --- /dev/null +++ b/conf/cmi/helfi_api_base.delete_revisions.yml @@ -0,0 +1,6 @@ +entity_types: + - node + - paragraph + - tpr_unit + - tpr_service + - tpr_errand_service diff --git a/conf/cmi/language/fi/field.field.node.announcement.field_announcement_title.yml b/conf/cmi/language/fi/field.field.node.announcement.field_announcement_title.yml new file mode 100644 index 000000000..8d33f85f2 --- /dev/null +++ b/conf/cmi/language/fi/field.field.node.announcement.field_announcement_title.yml @@ -0,0 +1,2 @@ +label: 'Poikkeusilmoituksen otsikko' +description: 'Tämä otsikko on avustavan teknologian käyttäjiä varten.' diff --git a/docker-compose.yml b/docker-compose.yml index e8b205098..c9be64c76 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,22 +82,6 @@ services: - "traefik.http.routers.${COMPOSE_PROJECT_NAME}-varnish.tls=true" - "traefik.http.services.${COMPOSE_PROJECT_NAME}-varnish.loadbalancer.server.port=6081" - "traefik.docker.network=stonehenge-network" - robo: - image: ghcr.io/city-of-helsinki/drupal-robo:latest - shm_size: '2gb' - tty: true - volumes: - - .:/app:delegated - networks: - - internal - - stonehenge-network - depends_on: - - app - profiles: - - testing - extra_hosts: - - "${DRUPAL_HOSTNAME}:host-gateway" - - "varnish-${DRUPAL_HOSTNAME}:host-gateway" networks: internal: external: false diff --git a/docker/openshift/crons/base.sh b/docker/openshift/crons/base.sh index 72d1ca248..764be0070 100644 --- a/docker/openshift/crons/base.sh +++ b/docker/openshift/crons/base.sh @@ -41,6 +41,7 @@ exec "/crons/purge-queue.sh" & exec "/crons/update-translations.sh" & # Uncomment this to enable content scheduler exec "/crons/content-scheduler.sh" & +exec "/crons/pubsub.sh" & while true do diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 603e6d959..0ae082a9a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,7 +16,7 @@ - + @@ -41,9 +41,13 @@ ./tests/dtt/src/ExistingSite + ./public/modules/custom/*/tests/src/ExistingSite + ./public/modules/contrib/*/tests/src/ExistingSite ./tests/dtt/src/ExistingSiteJavascript + ./public/modules/custom/*/tests/src/ExistingSiteJavascript + ./public/modules/contrib/*/tests/src/ExistingSiteJavascript diff --git a/public/modules/custom/helfi_etusivu/helfi_etusivu.module b/public/modules/custom/helfi_etusivu/helfi_etusivu.module index 9909d212c..79e9b2463 100644 --- a/public/modules/custom/helfi_etusivu/helfi_etusivu.module +++ b/public/modules/custom/helfi_etusivu/helfi_etusivu.module @@ -7,6 +7,8 @@ declare(strict_types = 1); +use Drupal\Core\Entity\ContentEntityInterface; +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\BubbleableMetadata; @@ -178,7 +180,7 @@ function helfi_etusivu_preprocess_toolbar(&$variables): void { /** * Implements hook_block_alter(). */ -function helfi_etusivu_block_alter(&$definitions) { +function helfi_etusivu_block_alter(&$definitions) : void { foreach ($definitions as $id => $definition) { if ($id === 'local_tasks_block') { $definitions[$id]['class'] = 'Drupal\helfi_etusivu\Plugin\Block\EtusivuLocalTasksBlock'; @@ -186,6 +188,59 @@ function helfi_etusivu_block_alter(&$definitions) { } } +/** + * Invalidate external caches. + * + * This is used to automatically flush caches on all external sites when + * an 'announcement' node marked as 'publish externally' is created/modified + * or deleted. + * + * @todo Decouple this from node save. Establishing connection to Azure PubSub + * service seems to take pretty long time + * + * @see https://helsinkisolutionoffice.atlassian.net/browse/UHF-8533 + * + * @param \Drupal\Core\Entity\EntityInterface $entity + * The entity to flush cache tags for. + */ +function helfi_etusivu_invalidate_external_caches(EntityInterface $entity) : void { + if (!$entity instanceof ContentEntityInterface) { + return; + } + // Only flush caches when we're saving announcement node with + // 'field_publish_externally' option checked. + $isAnnouncementNode = $entity->getEntityTypeId() === 'node' && $entity->bundle() === 'announcement'; + $publishExternally = $entity->hasField('field_publish_externally') && (bool) $entity->get('field_publish_externally')->value === TRUE; + + if (!$isAnnouncementNode || !$publishExternally) { + return; + } + /** @var \Drupal\helfi_api_base\Cache\CacheTagInvalidator $service */ + $service = \Drupal::service('helfi_api_base.cache_tag_invalidator'); + $service->invalidateTags(['helfi_external_entity_announcement']); +} + +/** + * Implements hook_entity_update(). + */ +function helfi_etusivu_entity_update(EntityInterface $entity) : void { + helfi_etusivu_invalidate_external_caches($entity); +} + +/** + * Implements hook_entity_delete(). + */ +function helfi_etusivu_entity_delete(EntityInterface $entity) : void { + helfi_etusivu_invalidate_external_caches($entity); +} + +/** + * Implements hook_entity_insert(). + */ +function helfi_etusivu_entity_insert(EntityInterface $entity) : void { + helfi_etusivu_invalidate_external_caches($entity); +} + /** * Implements hook_helfi_hero_design_alter(). */ diff --git a/tests/dtt/src/ExistingSite/ExistingSiteTestBase.php b/tests/dtt/src/ExistingSite/ExistingSiteTestBase.php deleted file mode 100644 index 466d51ac4..000000000 --- a/tests/dtt/src/ExistingSite/ExistingSiteTestBase.php +++ /dev/null @@ -1,34 +0,0 @@ -setupDefaultConfiguration(); - } - - /** - * {@inheritdoc} - */ - public function tearDown() { - parent::tearDown(); - $this->tearDownDefaultConfiguration(); - } - -} diff --git a/tests/dtt/src/ExistingSite/NewsContentTypeTest.php b/tests/dtt/src/ExistingSite/NewsContentTypeTest.php index 17f5fe492..82bbee1b4 100644 --- a/tests/dtt/src/ExistingSite/NewsContentTypeTest.php +++ b/tests/dtt/src/ExistingSite/NewsContentTypeTest.php @@ -5,6 +5,7 @@ namespace Drupal\Tests\dtt\ExistingSite; use Drupal\Core\Session\AccountInterface; +use Drupal\Tests\helfi_api_base\Functional\ExistingSiteTestBase; /** * Tests news endpoint. @@ -54,7 +55,11 @@ public function assertNodeCreation() : void { * Asserts that news json list has the expected item. */ public function assertJsonApiList() : void { - $this->drupalGetWithLanguage('/jsonapi/node/news'); + // Sort items by changed date to make sure our newly added item is visible. + $this->drupalGetWithLanguage('/jsonapi/node/news', options: ['query' => [ + 'sort[changed][path]' => 'changed', + 'sort[changed][direction]' => 'DESC', + ]]); $this->assertSession()->statusCodeEquals(200); $json = json_decode($this->getSession()->getPage()->getContent(), TRUE); diff --git a/tests/dtt/src/ExistingSiteJavascript/ExistingSiteJavascriptTestBase.php b/tests/dtt/src/ExistingSiteJavascript/ExistingSiteJavascriptTestBase.php deleted file mode 100644 index 9bd0725b1..000000000 --- a/tests/dtt/src/ExistingSiteJavascript/ExistingSiteJavascriptTestBase.php +++ /dev/null @@ -1,34 +0,0 @@ -setupDefaultConfiguration(); - } - - /** - * {@inheritdoc} - */ - public function tearDown() { - parent::tearDown(); - $this->tearDownDefaultConfiguration(); - } - -} diff --git a/tests/dtt/src/Traits/DefaultConfigurationTrait.php b/tests/dtt/src/Traits/DefaultConfigurationTrait.php deleted file mode 100644 index a0f100a03..000000000 --- a/tests/dtt/src/Traits/DefaultConfigurationTrait.php +++ /dev/null @@ -1,92 +0,0 @@ -getLanguage($langcode); - } - - /** - * Wrapper for drupalGet() to always set language code. - * - * @param string|\Drupal\Core\Url $url - * The url. - * @param string $langcode - * The langcode. - * @param array $options - * The options. - * @param array $headers - * The headers. - */ - protected function drupalGetWithLanguage(string|Url $url, string $langcode = 'en', array $options = [], array $headers = []) : void { - $options['language'] = $this->getLanguage($langcode); - $this->drupalGet($url, $options, $headers); - } - - /** - * Set up the default configuration. - */ - protected function setupDefaultConfiguration() : void { - $this->defaultLanguage = $this->getDefaultLanguageConfiguration() - ->get('selected_langcode'); - $this->setDefaultLanguage('en'); - } - - /** - * Restores the default configuration. - */ - protected function tearDownDefaultConfiguration() : void { - $this->setDefaultLanguage($this->defaultLanguage); - } - - /** - * Gets the configuration. - * - * @return \Drupal\Core\Config\Config - * The default configuration. - */ - protected function getDefaultLanguageConfiguration() : Config { - return \Drupal::configFactory() - ->getEditable('language.negotiation'); - } - - /** - * Sets the default language. - * - * @param string $langcode - * The langcode to set as default. - */ - protected function setDefaultLanguage(string $langcode) : void { - $this->getDefaultLanguageConfiguration() - ->set('selected_langcode', $langcode) - ->save(); - } - -}