Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to main #437

Merged
merged 30 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e4df5b7
UHF-8525: Flush external caches when global announcement is modified/…
tuutti May 26, 2023
7e047b9
UHF-8525: added comment
tuutti May 29, 2023
13a1d8e
UHF-8525: Updated upstream
tuutti Aug 31, 2023
867e414
UHF-8525: Fixed changes from upstream
tuutti Aug 31, 2023
a76c7bb
UHF-8525: Readded access check from upstream
tuutti Aug 31, 2023
60faee7
UHF-8525: Merge branch 'dev' into UHF-8525
tuutti Sep 11, 2023
ee71a63
UHF-8525: Add the published globally checkbox visible on the announce…
teroelonen Sep 11, 2023
6c88b99
UHF-8525: Merge branch 'UHF-8525' of github.com:City-of-Helsinki/drup…
teroelonen Sep 11, 2023
ce97076
Fixed DTT test
tuutti Sep 14, 2023
c988781
Fixed DTT test command
tuutti Sep 14, 2023
cf0ada6
Fixed DTT base url
tuutti Sep 14, 2023
2b5c04c
Merge pull request #436 from City-of-Helsinki/UHF-X-fix-dtt
tuutti Sep 14, 2023
e034a46
Use base classes provided by api-base module
tuutti Sep 14, 2023
97ffcb4
Merge pull request #374 from City-of-Helsinki/UHF-8525
tuutti Sep 18, 2023
126b7f8
UHF-8527: Start PubSub cron
tuutti Sep 18, 2023
2121052
Merge pull request #440 from City-of-Helsinki/UHF-8527
tuutti Sep 18, 2023
4deed73
Merge pull request #438 from City-of-Helsinki/UHF-X-fix-dtt
tuutti Sep 18, 2023
c6237f9
Update configuration
actions-bot Sep 18, 2023
a311163
Merge pull request #439 from City-of-Helsinki/update-configuration
tuutti Sep 19, 2023
9616b43
Update configuration
actions-bot Sep 21, 2023
c65f553
Merge pull request #441 from City-of-Helsinki/update-configuration
Jussiles Sep 21, 2023
14df8f0
Update configuration
actions-bot Sep 26, 2023
d5e5c1d
Merge pull request #442 from City-of-Helsinki/update-configuration
teroelonen Sep 26, 2023
57a60a6
Make the global announcement check box visible on the node form
teroelonen Sep 26, 2023
e3358f9
Merge pull request #443 from City-of-Helsinki/UHF-X_make_global_annou…
teroelonen Sep 26, 2023
b4f1f70
UHF-9060: Update helfi_tunnistamo to 3.0.0 version
teroelonen Sep 27, 2023
79124b3
Update configuration
actions-bot Sep 27, 2023
980ace9
Merge pull request #444 from City-of-Helsinki/UHF-9060
khalima Sep 27, 2023
783c2d7
automatic update tried to remove global announcement button
rpnykanen Sep 27, 2023
393ba1d
Merge pull request #445 from City-of-Helsinki/update-configuration
rpnykanen Sep 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
136 changes: 68 additions & 68 deletions composer.lock

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions conf/cmi/core.base_field_override.node.announcement.title.yml
Original file line number Diff line number Diff line change
@@ -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
35 changes: 25 additions & 10 deletions conf/cmi/core.entity_form_display.node.announcement.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,15 +20,15 @@ dependencies:
- select2
- text
_core:
default_config_hash: le2Wzlas0qZ9Bj-o6WlJbHDeisFrucs9F4B3VOK8t_w
default_config_hash: 0ewsu2ZhpNhAo4t7wkUgEa9ABQAkcsF7IXtR-kFeDUg
id: node.announcement.default
targetEntityType: node
bundle: announcement
mode: default
content:
body:
type: text_textarea_with_summary
weight: 15
weight: 17
region: content
settings:
rows: 9
Expand All @@ -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%
Expand All @@ -60,39 +61,54 @@ content:
third_party_settings: { }
field_announcement_link:
type: link_default
weight: 16
weight: 18
region: content
settings:
placeholder_url: ''
placeholder_title: ''
third_party_settings: { }
field_announcement_service_pages:
type: select2_entity_reference
weight: 14
weight: 16
region: content
settings:
width: 100%
autocomplete: true
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%
autocomplete: true
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
Expand Down Expand Up @@ -124,7 +140,7 @@ content:
settings: { }
third_party_settings: { }
simple_sitemap:
weight: 10
weight: 12
region: content
settings: { }
third_party_settings: { }
Expand Down Expand Up @@ -165,7 +181,6 @@ content:
settings: { }
third_party_settings: { }
hidden:
field_publish_externally: true
hide_sidebar_navigation: true
promote: true
sticky: true
Expand Down
11 changes: 10 additions & 1 deletion conf/cmi/core.entity_view_display.node.announcement.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ 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
module:
- text
- user
_core:
default_config_hash: FhIJpRvY90w782EYtR2V2Yfppyglwp191xkVdXEEbbM
default_config_hash: OwH532HYBVjDOUW0iJnoDWc2yFGZwwGJnAZEmZPjLCA
id: node.announcement.teaser
targetEntityType: node
bundle: announcement
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions conf/cmi/field.storage.node.field_announcement_title.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions conf/cmi/helfi_api_base.delete_revisions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
entity_types:
- node
- paragraph
- tpr_unit
- tpr_service
- tpr_errand_service
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
label: 'Poikkeusilmoituksen otsikko'
description: 'Tämä otsikko on avustavan teknologian käyttäjiä varten.'
16 changes: 0 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docker/openshift/crons/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<env name="DTT_MINK_DRIVER_ARGS" value='["chrome", {"chromeOptions":{"w3c": false }}, "http://127.0.0.1:4444"]'/>
<env name="DTT_API_OPTIONS" value='{"socketTimeout": 360, "domWaitTimeout": 3600000}' />
<env name="DTT_API_URL" value="http://127.0.0.1:9222"/>
<env name="DTT_BASE_URL" value="http://127.0.0.1:8080"/>
<env name="DTT_BASE_URL" value="http://127.0.0.1:8888"/>
</php>
<testsuites>
<testsuite name="unit">
Expand All @@ -41,9 +41,13 @@
</testsuite>
<testsuite name="existing-site">
<directory>./tests/dtt/src/ExistingSite</directory>
<directory>./public/modules/custom/*/tests/src/ExistingSite</directory>
<directory>./public/modules/contrib/*/tests/src/ExistingSite</directory>
</testsuite>
<testsuite name="existing-site-javascript">
<directory>./tests/dtt/src/ExistingSiteJavascript</directory>
<directory>./public/modules/custom/*/tests/src/ExistingSiteJavascript</directory>
<directory>./public/modules/contrib/*/tests/src/ExistingSiteJavascript</directory>
</testsuite>
</testsuites>
<listeners>
Expand Down
57 changes: 56 additions & 1 deletion public/modules/custom/helfi_etusivu/helfi_etusivu.module
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -178,14 +180,67 @@ 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';
}
}
}

/**
* 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().
*/
Expand Down
Loading