From 1b3cbbdeb2ee4542664048f2211df4f707c4f91b Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 11 Dec 2024 12:06:48 +0100 Subject: [PATCH 01/13] feat: Access notify fields Refs: #RW-1058 --- .../custom/reliefweb_entities/src/Services/ReportFormAlter.php | 1 - 1 file changed, 1 deletion(-) diff --git a/html/modules/custom/reliefweb_entities/src/Services/ReportFormAlter.php b/html/modules/custom/reliefweb_entities/src/Services/ReportFormAlter.php index d52c58e15..a9708690d 100644 --- a/html/modules/custom/reliefweb_entities/src/Services/ReportFormAlter.php +++ b/html/modules/custom/reliefweb_entities/src/Services/ReportFormAlter.php @@ -465,7 +465,6 @@ protected function alterFieldsForContributors(array &$form, FormStateInterface $ // Hide fields. $form['field_bury']['#access'] = FALSE; $form['field_feature']['#access'] = FALSE; - $form['field_notify']['#access'] = FALSE; $form['field_headline']['#access'] = FALSE; $form['field_headline_title']['#access'] = FALSE; From 61c22d0b3ce231373fbc0dd4a4dd671396aea38e Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 11 Dec 2024 12:07:34 +0100 Subject: [PATCH 02/13] feat: Embargo Refs: #RW-1058 --- .../custom/reliefweb_entities/src/Entity/Report.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/html/modules/custom/reliefweb_entities/src/Entity/Report.php b/html/modules/custom/reliefweb_entities/src/Entity/Report.php index d4dbc56be..801dda610 100644 --- a/html/modules/custom/reliefweb_entities/src/Entity/Report.php +++ b/html/modules/custom/reliefweb_entities/src/Entity/Report.php @@ -242,8 +242,15 @@ public function preSave(EntityStorageInterface $storage) { } } + // Update the entity status based on the user posting rights. + $this->updateModerationStatusFromPostingRights(); + // Change the status to `embargoed` if there is an embargo date. - if (!empty($this->field_embargo_date->value) && $this->getModerationStatus() !== 'draft') { + if (!empty($this->field_embargo_date->value) && !in_array($this->getModerationStatus(), [ + 'draft', + 'pending', + 'refused', + ])) { $this->setModerationStatus('embargoed'); $message = strtr('Embargoed (to be automatically published on @date).', [ @@ -258,9 +265,6 @@ public function preSave(EntityStorageInterface $storage) { // Prepare notifications. $this->preparePublicationNotification(); - // Update the entity status based on the user posting rights. - $this->updateModerationStatusFromPostingRights(); - // Update the entity status based on the source(s) moderation status. $this->updateModerationStatusFromSourceStatus(); From 9c053cfb8a9b79d03d2e72b7fa255c9d3f4f471c Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Thu, 12 Dec 2024 08:20:21 +0100 Subject: [PATCH 03/13] chore: Add notify to add/edit form --- .../templates/form/node-edit-form--report.html.twig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/html/themes/custom/common_design_subtheme/templates/form/node-edit-form--report.html.twig b/html/themes/custom/common_design_subtheme/templates/form/node-edit-form--report.html.twig index 5d96b44f5..677e8c843 100644 --- a/html/themes/custom/common_design_subtheme/templates/form/node-edit-form--report.html.twig +++ b/html/themes/custom/common_design_subtheme/templates/form/node-edit-form--report.html.twig @@ -45,6 +45,7 @@ }%} {% set submission_sections = { + 'editorial-flags': 'Notify'|t, 'actions': 'Save'|t, 'edit-revision-information': 'Revisions'|t, }%} @@ -128,6 +129,11 @@ {{ form.field_feature }} {{ form.field_notify }} +{% else %} +
+ {% trans %}Notify{% endtrans %} + {{ form.field_notify }} +
{% endif %}
From b52a7fcc71b04cd39d3d61159095f004e2da747b Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Thu, 12 Dec 2024 11:33:42 +0100 Subject: [PATCH 04/13] feat: Filter posting rights on user name Refs: #RW-1058 --- .../reliefweb-user-posting-rights.css | 9 ++++ .../reliefweb-user-posting-rights.js | 54 ++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css index 254b8e659..3b3a08066 100644 --- a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css +++ b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css @@ -41,9 +41,18 @@ flex-wrap: wrap; align-items: center; } + .field--type-reliefweb-user-posting-rights div[data-filters][data-job="all"][data-training="all"][data-report="all"] ~ ul li { display: flex; } + +.field--type-reliefweb-user-posting-rights div[data-filters]:not([data-name="all"]) ~ ul li { + display: none !important; +} +.field--type-reliefweb-user-posting-rights div[data-filters]:not([data-name="all"]) ~ ul li[data-user-filtered] { + display: flex !important; +} + .field--type-reliefweb-user-posting-rights div[data-filters][data-job="0"] ~ ul li[data-job="0"] { display: flex; } diff --git a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js index 2ee8e1cf7..a3b02336c 100644 --- a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js +++ b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js @@ -84,6 +84,42 @@ return label; }, + /** + * Create a filter for users. + */ + createUserSelect: function () { + let data = this.getFieldData(); + let name = 'name'; + + var select = document.createElement('select'); + select.setAttribute('data-name', name); + + var span = document.createElement('span'); + span.appendChild(document.createTextNode(name)); + + var label = document.createElement('label'); + label.appendChild(span); + + var option = document.createElement('option'); + option.appendChild(document.createTextNode(t('Any'))); + option.setAttribute('value', 'all'); + option.setAttribute('selected', ''); + select.appendChild(option); + + // List content in reverse order (most recently added first). + for (var i = data.length - 1; i >= 0; i--) { + var option = document.createElement('option'); + option.appendChild(document.createTextNode(data[i].name)); + option.setAttribute('value', data[i].name); + select.appendChild(option); + } + + label.appendChild(select); + label.className = name; + + return label; + }, + /** * Create the user notes field. */ @@ -118,6 +154,7 @@ container.setAttribute('data-job', data.job); container.setAttribute('data-training', data.training); container.setAttribute('data-report', data.report); + container.setAttribute('data-name', data.name); // User info. var info = document.createElement('div'); @@ -208,6 +245,7 @@ container.setAttribute('data-job', 'all'); container.setAttribute('data-training', 'all'); container.setAttribute('data-report', 'all'); + container.setAttribute('data-name', 'all'); var title = document.createElement('span'); title.appendChild(document.createTextNode(t('Filter: '))); @@ -218,6 +256,9 @@ container.appendChild(this.createSelect('training', '', false, true)); container.appendChild(this.createSelect('report', '', false, true)); + // User filter. + container.appendChild(this.createUserSelect()); + return container; }, @@ -516,7 +557,7 @@ var name = target.getAttribute('data-name'); // Update the rights attributes of the user row. - if (name === 'job' || name === 'training' || name === 'report') { + if (name === 'job' || name === 'training' || name === 'report' || name === 'name') { var parent = target.parentNode.parentNode; // If the parent is not the filter container, then it's a select @@ -529,6 +570,17 @@ parent.setAttribute('data-' + name, target.value); parent.setAttribute('data-modified', ''); this.updateData(); + + // Filter on user name. + if (parent.hasAttribute('data-filters') && name === 'name') { + let grandParent = parent.parentNode; + if (grandParent.querySelector('li[data-user-filtered]')) { + grandParent.querySelector('li[data-user-filtered]').removeAttribute('data-user-filtered'); + } + if (target.value !== 'all') { + grandParent.querySelector('li[data-name="' + target.value + '"]').setAttribute('data-user-filtered', ''); + } + } } } }, From 1060bf9766600241ee12734ff4f7bb833aaa9edc Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Thu, 12 Dec 2024 13:38:44 +0100 Subject: [PATCH 05/13] feat: Filter posting rights on user name Refs: #RW-1058 --- .../reliefweb-user-posting-rights.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js index a3b02336c..2ff544c28 100644 --- a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js +++ b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js @@ -106,8 +106,9 @@ option.setAttribute('selected', ''); select.appendChild(option); - // List content in reverse order (most recently added first). - for (var i = data.length - 1; i >= 0; i--) { + // List alphabetically. + data = data.sort((a, b) => a.name.localeCompare(b.name)); + for (var i = 0; i < data.length; i++) { var option = document.createElement('option'); option.appendChild(document.createTextNode(data[i].name)); option.setAttribute('value', data[i].name); From 169bec861fbc9d8f281a2b0ffd334f6e2ed4b2d1 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 13 Dec 2024 09:34:56 +0100 Subject: [PATCH 06/13] chore: Add permission --- config/user.role.contributor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/user.role.contributor.yml b/config/user.role.contributor.yml index e702fb568..c75db337b 100644 --- a/config/user.role.contributor.yml +++ b/config/user.role.contributor.yml @@ -25,3 +25,4 @@ permissions: - 'edit own report content' - 'update media' - 'view own unpublished media' + - 'view report revisions' From ccbc2d2c97564483dc07542a54d3426b9df1e13f Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 13 Dec 2024 12:07:39 +0100 Subject: [PATCH 07/13] feat: Filter posting rights on user id, name or mail Refs: #RW-1058 --- .../reliefweb-user-posting-rights.css | 10 ++-- .../reliefweb-user-posting-rights.js | 57 +++++++++---------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css index 3b3a08066..5d22b0acb 100644 --- a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css +++ b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css @@ -28,12 +28,14 @@ margin: 0 8px; } .field--type-reliefweb-user-posting-rights label span, -.field--type-reliefweb-user-posting-rights label select { +.field--type-reliefweb-user-posting-rights label select, +.field--type-reliefweb-user-posting-rights label input[type="text"] { display: inline-block; margin: 0 8px 0 0; vertical-align: middle; } -.field--type-reliefweb-user-posting-rights label select { +.field--type-reliefweb-user-posting-rights label select, +.field--type-reliefweb-user-posting-rights label input[type="text"] { width: auto; } .field--type-reliefweb-user-posting-rights div[data-filters] ~ ul li { @@ -46,10 +48,10 @@ display: flex; } -.field--type-reliefweb-user-posting-rights div[data-filters]:not([data-name="all"]) ~ ul li { +.field--type-reliefweb-user-posting-rights div[data-filters]:not([data-name=""]) ~ ul li { display: none !important; } -.field--type-reliefweb-user-posting-rights div[data-filters]:not([data-name="all"]) ~ ul li[data-user-filtered] { +.field--type-reliefweb-user-posting-rights div[data-filters]:not([data-name=""]) ~ ul li[data-user-filtered] { display: flex !important; } diff --git a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js index 2ff544c28..738a0b4ad 100644 --- a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js +++ b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js @@ -88,10 +88,10 @@ * Create a filter for users. */ createUserSelect: function () { - let data = this.getFieldData(); let name = 'name'; - var select = document.createElement('select'); + var select = document.createElement('input'); + select.setAttribute('type', 'text'); select.setAttribute('data-name', name); var span = document.createElement('span'); @@ -99,22 +99,6 @@ var label = document.createElement('label'); label.appendChild(span); - - var option = document.createElement('option'); - option.appendChild(document.createTextNode(t('Any'))); - option.setAttribute('value', 'all'); - option.setAttribute('selected', ''); - select.appendChild(option); - - // List alphabetically. - data = data.sort((a, b) => a.name.localeCompare(b.name)); - for (var i = 0; i < data.length; i++) { - var option = document.createElement('option'); - option.appendChild(document.createTextNode(data[i].name)); - option.setAttribute('value', data[i].name); - select.appendChild(option); - } - label.appendChild(select); label.className = name; @@ -155,7 +139,7 @@ container.setAttribute('data-job', data.job); container.setAttribute('data-training', data.training); container.setAttribute('data-report', data.report); - container.setAttribute('data-name', data.name); + container.setAttribute('data-name', [data.id, data.name, data.mail].join(', ')); // User info. var info = document.createElement('div'); @@ -246,7 +230,7 @@ container.setAttribute('data-job', 'all'); container.setAttribute('data-training', 'all'); container.setAttribute('data-report', 'all'); - container.setAttribute('data-name', 'all'); + container.setAttribute('data-name', ''); var title = document.createElement('span'); title.appendChild(document.createTextNode(t('Filter: '))); @@ -301,6 +285,7 @@ // Handle change events on the different select elements in the form. container.addEventListener('change', this.handleChange.bind(this)); + container.addEventListener('keyup', this.handleChange.bind(this)); // Handle focus out events from notes fields. container.addEventListener('focusout', this.handleFocusOut.bind(this)); @@ -558,7 +543,7 @@ var name = target.getAttribute('data-name'); // Update the rights attributes of the user row. - if (name === 'job' || name === 'training' || name === 'report' || name === 'name') { + if (name === 'job' || name === 'training' || name === 'report') { var parent = target.parentNode.parentNode; // If the parent is not the filter container, then it's a select @@ -571,17 +556,29 @@ parent.setAttribute('data-' + name, target.value); parent.setAttribute('data-modified', ''); this.updateData(); + } + } + else if (target && target.tagName === 'INPUT') { + var name = target.getAttribute('data-name'); + var parent = target.parentNode.parentNode; + + // Filter on user name. + if (parent.hasAttribute('data-filters') && name === 'name') { + let grandParent = parent.parentNode; + if (grandParent.querySelectorAll('li[data-user-filtered]').length > 0) { + Array.from(grandParent.querySelectorAll('li[data-user-filtered]')) + .forEach(e => e.removeAttribute('data-user-filtered')); + } - // Filter on user name. - if (parent.hasAttribute('data-filters') && name === 'name') { - let grandParent = parent.parentNode; - if (grandParent.querySelector('li[data-user-filtered]')) { - grandParent.querySelector('li[data-user-filtered]').removeAttribute('data-user-filtered'); - } - if (target.value !== 'all') { - grandParent.querySelector('li[data-name="' + target.value + '"]').setAttribute('data-user-filtered', ''); - } + if (target.value !== '') { + Array.from(grandParent.querySelectorAll('li[data-name*="' + target.value + '"]')) + .forEach(e => e.setAttribute('data-user-filtered', '')); } + + // Set the attribute to the value of the select element. + parent.setAttribute('data-' + name, target.value); + parent.setAttribute('data-modified', ''); + this.updateData(); } } }, From bbe0e88527e8ebe06b54af4c5096e078a8e0d486 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 13 Dec 2024 13:23:23 +0100 Subject: [PATCH 08/13] feat: Filter posting rights on user id, name or mail Refs: #RW-1058 --- .../reliefweb-user-posting-rights.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js index 738a0b4ad..13d00534d 100644 --- a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js +++ b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js @@ -87,7 +87,7 @@ /** * Create a filter for users. */ - createUserSelect: function () { + createUserFilter: function () { let name = 'name'; var select = document.createElement('input'); @@ -95,7 +95,7 @@ select.setAttribute('data-name', name); var span = document.createElement('span'); - span.appendChild(document.createTextNode(name)); + span.appendChild(document.createTextNode(t('Id, name, email'))); var label = document.createElement('label'); label.appendChild(span); @@ -242,7 +242,7 @@ container.appendChild(this.createSelect('report', '', false, true)); // User filter. - container.appendChild(this.createUserSelect()); + container.appendChild(this.createUserFilter()); return container; }, From 4e4868ef36b578c122ea89b08fce6f5c9648de5e Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 13 Dec 2024 13:23:54 +0100 Subject: [PATCH 09/13] feat: Filter posting rights on user id, name or mail Refs: #RW-1058 --- .../reliefweb-user-posting-rights.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js index 13d00534d..d2510a703 100644 --- a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js +++ b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.js @@ -95,7 +95,7 @@ select.setAttribute('data-name', name); var span = document.createElement('span'); - span.appendChild(document.createTextNode(t('Id, name, email'))); + span.appendChild(document.createTextNode(t('user id, name, email'))); var label = document.createElement('label'); label.appendChild(span); From 6cd310f55e851eb968812ea533fced3ca8477ee6 Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 16 Dec 2024 02:41:59 +0000 Subject: [PATCH 10/13] chore: proper permissions to access revision history for contributors Refs: RW-1058 --- config/user.role.contributor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/user.role.contributor.yml b/config/user.role.contributor.yml index c75db337b..5f260b723 100644 --- a/config/user.role.contributor.yml +++ b/config/user.role.contributor.yml @@ -10,6 +10,7 @@ dependencies: - node - reliefweb_files - reliefweb_form + - reliefweb_revisions id: contributor label: Contributor weight: 9 @@ -24,5 +25,5 @@ permissions: - 'edit own image_report media' - 'edit own report content' - 'update media' + - 'view entity history' - 'view own unpublished media' - - 'view report revisions' From 9d9e082c6158919cf47d60b175b5a9b4e400f767 Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 16 Dec 2024 02:48:50 +0000 Subject: [PATCH 11/13] fix: do not change aspect of id/email field to add user to source posting rights Refs: RW-1058 --- .../reliefweb-user-posting-rights.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css index 5d22b0acb..45b4de6f8 100644 --- a/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css +++ b/html/modules/custom/reliefweb_fields/components/reliefweb-user-posting-rights/reliefweb-user-posting-rights.css @@ -35,7 +35,7 @@ vertical-align: middle; } .field--type-reliefweb-user-posting-rights label select, -.field--type-reliefweb-user-posting-rights label input[type="text"] { +.field--type-reliefweb-user-posting-rights [data-filters] label input[type="text"] { width: auto; } .field--type-reliefweb-user-posting-rights div[data-filters] ~ ul li { From 845879102cc930a3072b1f42c521090cfbb5248f Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 16 Dec 2024 03:33:21 +0000 Subject: [PATCH 12/13] chore: only save as embargoed if the document would have been published if it didn't have an embargo date Refs: RW-1058 --- .../custom/reliefweb_entities/src/Entity/Report.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/html/modules/custom/reliefweb_entities/src/Entity/Report.php b/html/modules/custom/reliefweb_entities/src/Entity/Report.php index 801dda610..5746f6ab1 100644 --- a/html/modules/custom/reliefweb_entities/src/Entity/Report.php +++ b/html/modules/custom/reliefweb_entities/src/Entity/Report.php @@ -246,10 +246,9 @@ public function preSave(EntityStorageInterface $storage) { $this->updateModerationStatusFromPostingRights(); // Change the status to `embargoed` if there is an embargo date. - if (!empty($this->field_embargo_date->value) && !in_array($this->getModerationStatus(), [ - 'draft', - 'pending', - 'refused', + if (!empty($this->field_embargo_date->value) && in_array($this->getModerationStatus(), [ + 'to-review', + 'published', ])) { $this->setModerationStatus('embargoed'); From 85f7ce8df056f5d09e71865509e27d9384fdf528 Mon Sep 17 00:00:00 2001 From: orakili Date: Mon, 16 Dec 2024 04:05:19 +0000 Subject: [PATCH 13/13] fix: ensure embargoed documents stay embargoed Refs: RW-1058 --- html/modules/custom/reliefweb_entities/src/Entity/Report.php | 1 + 1 file changed, 1 insertion(+) diff --git a/html/modules/custom/reliefweb_entities/src/Entity/Report.php b/html/modules/custom/reliefweb_entities/src/Entity/Report.php index 5746f6ab1..8d22935fb 100644 --- a/html/modules/custom/reliefweb_entities/src/Entity/Report.php +++ b/html/modules/custom/reliefweb_entities/src/Entity/Report.php @@ -247,6 +247,7 @@ public function preSave(EntityStorageInterface $storage) { // Change the status to `embargoed` if there is an embargo date. if (!empty($this->field_embargo_date->value) && in_array($this->getModerationStatus(), [ + 'embargoed', 'to-review', 'published', ])) {