From f0522995fe52b22766b07b5a80ccd5b1b53312c1 Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Thu, 23 May 2024 13:48:21 +1000 Subject: [PATCH 1/7] Update English translations. --- src/translations/en/workflow.php | 95 ++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 34 deletions(-) diff --git a/src/translations/en/workflow.php b/src/translations/en/workflow.php index 529a3f1..746236d 100644 --- a/src/translations/en/workflow.php +++ b/src/translations/en/workflow.php @@ -1,48 +1,21 @@ 'When an editor submits entry for approval:', - 'workflow_publisher_notification_subject' => '"{{ submission.ownerTitle }}" has been submitted for approval on {{ submission.getOwnerSite() }}.', - 'workflow_publisher_notification_body' => "Hey {{ user.friendlyName }},\n\n" . - "{{ review.user }} has submitted the entry \"{{ submission.ownerTitle }}\" for approval on {{ submission.ownerSite }}.\n\n" . - "{% if review.notes %}{{ review.roleName }} Notes: \"{{ review.notes }}\"\n\n{% endif %}" . - "To review it please log into your control panel.\n\n" . - "{{ submission.ownerCpUrl }}", - - 'workflow_editor_review_notification_heading' => 'When a reviewer approves or rejects an editor submission:', - 'workflow_editor_review_notification_subject' => 'Your submission for "{{ submission.ownerTitle }}" has been {{ review.status }} on {{ submission.ownerSite }}.', - 'workflow_editor_review_notification_body' => "Hey {{ user.friendlyName }},\n\n" . - "Your submission for {{ submission.ownerTitle }} has been {{ review.status }} {{ review.dateCreated | date }} on {{ submission.ownerSite }}.\n\n" . - "{% if review.notes %}{{ review.roleName }} Notes: \"{{ review.notes }}\"\n\n{% endif %}" . - "View your submission by logging into your control panel.\n\n" . - "{{ submission.ownerCpUrl }}", - - 'workflow_editor_notification_heading' => 'When a publisher approves or rejects an editor submission:', - 'workflow_editor_notification_subject' => 'Your submission for "{{ submission.ownerTitle }}" has been {{ review.status }} on {{ submission.ownerSite }}.', - 'workflow_editor_notification_body' => "Hey {{ user.friendlyName }},\n\n" . - "Your submission for {{ submission.ownerTitle }} has been {{ review.status }} {{ review.dateCreated | date }} on {{ submission.ownerSite }}.\n\n" . - "{% if review.notes %}{{ review.roleName }} Notes: \"{{ review.notes }}\"\n\n{% endif %}" . - "View your submission by logging into your control panel.\n\n" . - "{{ submission.ownerCpUrl }}", - - 'workflow_published_author_notification_heading' => 'When a publisher approves and publishes an entry to notify the entry author:', - 'workflow_published_author_notification_subject' => 'Your entry "{{ submission.ownerTitle }}" has been published on {{ submission.ownerSite }}.', - 'workflow_published_author_notification_body' => "Hey {{ user.friendlyName }},\n\n" . - "Your entry {{ submission.ownerTitle }} has been published {{ review.dateCreated | date }} on {{ submission.ownerSite }}.\n\n" . - "View your entry by logging into your control panel.\n\n" . - "{{ submission.ownerCpUrl }}", - 'Action #{num}' => 'Action #{num}', + 'Add a user group' => 'Add a user group', + 'All' => 'All', 'All submissions' => 'All submissions', + 'Approve' => 'Approve', 'Approve and publish' => 'Approve and publish', 'Approved' => 'Approved', + 'Approve only' => 'Approve only', 'Are you sure you want to delete this review?' => 'Are you sure you want to delete this review?', 'Are you sure you want to delete this submission?' => 'Are you sure you want to delete this submission?', 'Awaiting approval' => 'Awaiting approval', 'Awaiting review' => 'Awaiting review', + 'CC Publisher Email' => 'CC Publisher Email', + 'CC Reviewer Email' => 'CC Reviewer Email', + 'Changing this may result in submissions being lost in the review process.' => 'Changing this may result in submissions being lost in the review process.', 'Close' => 'Close', 'Could not approve and publish.' => 'Could not approve and publish.', 'Could not revoke submission.' => 'Could not revoke submission.', @@ -50,8 +23,14 @@ 'Could not submit for approval.' => 'Could not submit for approval.', 'Could not update status due to a validation error.' => 'Could not update status due to a validation error.', 'Could not update statuses due to validation errors.' => 'Could not update statuses due to validation errors.', + 'created' => 'created', 'Date Submitted' => 'Date Submitted', 'Editor' => 'Editor', + 'Editor Notifications' => 'Editor Notifications', + 'Editor Notifications - Additional Options' => 'Editor Notifications - Additional Options', + 'Editor Submission Notes Required' => 'Editor Submission Notes Required', + 'Editor User Group' => 'Editor User Group', + 'Enabled Sections' => 'Enabled Sections', 'Entry' => 'Entry', 'Entry approved and published.' => 'Entry approved and published.', 'Entry submitted for approval.' => 'Entry submitted for approval.', @@ -59,29 +38,54 @@ 'Failed to send published author notification to {value} - “{message}” {file}:{line}' => 'Failed to send published author notification to {value} - “{message}” {file}:{line}', 'Failed to send publisher notification to {value} - “{message}” {file}:{line}' => 'Failed to send publisher notification to {value} - “{message}” {file}:{line}', 'Failed to send reviewer notification to {value} - “{message}” {file}:{line}' => 'Failed to send reviewer notification to {value} - “{message}” {file}:{line}', + 'General Settings' => 'General Settings', 'Last Reviewed' => 'Last Reviewed', 'Last Reviewed By' => 'Last Reviewed By', + 'Limit' => 'Limit', + 'Lock Draft Submissions' => 'Lock Draft Submissions', + 'None' => 'None', 'No review exists with the ID “{id}”.' => 'No review exists with the ID “{id}”.', 'No reviews for this submission.' => 'No reviews for this submission.', 'No submissions.' => 'No submissions.', 'No submission with the ID “{id}”' => 'No submission with the ID “{id}”', 'Notes' => 'Notes', + 'Notes about your response.' => 'Notes about your response.', + 'Notes about your submission' => 'Notes about your submission', + 'Notes about your submission (required)' => 'Notes about your submission (required)', 'Notes are required' => 'Notes are required', + 'Notifications' => 'Notifications', 'Number of Reviewers' => 'Number of Reviewers', 'Overview' => 'Overview', 'Pending' => 'Pending', + 'Permissions' => 'Permissions', + 'Published Author Notifications' => 'Published Author Notifications', 'Publisher' => 'Publisher', + 'Publisher Notifications' => 'Publisher Notifications', 'Publishers To Receive Notifications' => 'Publishers To Receive Notifications', + 'Publisher Submission Notes Required' => 'Publisher Submission Notes Required', + 'Publisher User Group' => 'Publisher User Group', + 'Reject' => 'Reject', 'Rejected' => 'Rejected', + 'Reply-To Publisher Email' => 'Reply-To Publisher Email', + 'Reply-To Reviewer Email' => 'Reply-To Reviewer Email', 'Review deleted.' => 'Review deleted.', 'Reviewer' => 'Reviewer', + 'Reviewer Approval Notifications' => 'Reviewer Approval Notifications', + 'Reviewer Notifications' => 'Reviewer Notifications', + 'Reviewer User Groups' => 'Reviewer User Groups', 'Revoked' => 'Revoked', 'Revoke submission' => 'Revoke submission', 'Save' => 'Save', 'Save draft and submit for review' => 'Save draft and submit for review', 'Select all, or specific publishers to receive email notifications. By default, all will be notified.' => 'Select all, or specific publishers to receive email notifications. By default, all will be notified.', 'Select a Publisher User Group first.' => 'Select a Publisher User Group first.', + 'Select the user groups that your reviewers belong to. Reviewers are users that can review and edit submissions and pass them along for approval, but not publish live. The review process flows from the first to the last user group in the table.' => 'Select the user groups that your reviewers belong to. Reviewers are users that can review and edit submissions and pass them along for approval, but not publish live. The review process flows from the first to the last user group in the table.', + 'Select the user group that your editors belong to. Editors are users that can edit content, but not publish live.' => 'Select the user group that your editors belong to. Editors are users that can edit content, but not publish live.', + 'Select the user group that your publishers belong to. Publishers are users who are notified when an editor submits content for review, and can approve content to be published live.' => 'Select the user group that your publishers belong to. Publishers are users who are notified when an editor submits content for review, and can approve content to be published live.', + 'Select which sections the workflow should be enabled for.' => 'Select which sections the workflow should be enabled for.', 'Set status' => 'Set status', + 'Settings' => 'Settings', + 'Show submissions for certain status.' => 'Show submissions for certain status.', 'Site' => 'Site', 'Status' => 'Status', 'Statuses updated.' => 'Statuses updated.', @@ -109,12 +113,35 @@ 'Unable to delete submission.' => 'Unable to delete submission.', 'Unable to determine field layout for entry.' => 'Unable to determine field layout for entry.', 'Unable to edit entry once it has been submitted for review.' => 'Unable to edit entry once it has been submitted for review.', + 'Unable to find owner entry "{id}".' => 'Unable to find owner entry "{id}".', 'Unable to find submission.' => 'Unable to find submission.', 'Unable to save submission.' => 'Unable to save submission.', + 'User Group' => 'User Group', 'View changes' => 'View changes', 'View submissions' => 'View submissions', + 'Whether an entry should be locked for editing after it‘s been submitted for review.' => 'Whether an entry should be locked for editing after it‘s been submitted for review.', + 'Whether editor notifications should include the reviewer‘s or publisher‘s email whose triggered the action.' => 'Whether editor notifications should include the reviewer‘s or publisher‘s email whose triggered the action.', + 'Whether editors are required to enter a note in their submissions.' => 'Whether editors are required to enter a note in their submissions.', + 'Whether email notifications should be delivered to editors when each reviewer approves an entry after review.' => 'Whether email notifications should be delivered to editors when each reviewer approves an entry after review.', + 'Whether email notifications should be delivered to individual editors when approved or rejected.' => 'Whether email notifications should be delivered to individual editors when approved or rejected.', + 'Whether email notifications should be delivered to publishers when editors submit an entry for review.' => 'Whether email notifications should be delivered to publishers when editors submit an entry for review.', + 'Whether email notifications should be delivered to reviewers when editors submit an entry for review.' => 'Whether email notifications should be delivered to reviewers when editors submit an entry for review.', + 'Whether email notifications should be delivered to the entry author when approved and published by a Publisher.' => 'Whether email notifications should be delivered to the entry author when approved and published by a Publisher.', + 'Whether publishers are required to enter a note in their submissions.' => 'Whether publishers are required to enter a note in their submissions.', 'Workflow' => 'Workflow', 'Workflow Submissions' => 'Workflow Submissions', + 'workflow_editor_notification_body' => 'workflow_editor_notification_body', + 'workflow_editor_notification_heading' => 'workflow_editor_notification_heading', + 'workflow_editor_notification_subject' => 'workflow_editor_notification_subject', + 'workflow_editor_review_notification_body' => 'workflow_editor_review_notification_body', + 'workflow_editor_review_notification_heading' => 'workflow_editor_review_notification_heading', + 'workflow_editor_review_notification_subject' => 'workflow_editor_review_notification_subject', + 'workflow_published_author_notification_body' => 'workflow_published_author_notification_body', + 'workflow_published_author_notification_heading' => 'workflow_published_author_notification_heading', + 'workflow_published_author_notification_subject' => 'workflow_published_author_notification_subject', + 'workflow_publisher_notification_body' => 'workflow_publisher_notification_body', + 'workflow_publisher_notification_heading' => 'workflow_publisher_notification_heading', + 'workflow_publisher_notification_subject' => 'workflow_publisher_notification_subject', 'You cannot approve your own submission.' => 'You cannot approve your own submission.', '[Deleted element]' => '[Deleted element]', '{role} Notes: “{note}”' => '{role} Notes: “{note}”', From 62a29f30478a5954d5ff369dd20cd070406bb765 Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Tue, 28 May 2024 00:34:17 +1000 Subject: [PATCH 2/7] Fix translations --- src/translations/en/workflow.php | 47 ++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/src/translations/en/workflow.php b/src/translations/en/workflow.php index 746236d..a63b09d 100644 --- a/src/translations/en/workflow.php +++ b/src/translations/en/workflow.php @@ -1,6 +1,41 @@ 'When an editor submits entry for approval:', + 'workflow_publisher_notification_subject' => '"{{ submission.ownerTitle }}" has been submitted for approval on {{ submission.getOwnerSite() }}.', + 'workflow_publisher_notification_body' => "Hey {{ user.friendlyName }},\n\n" . + "{{ review.user }} has submitted the entry \"{{ submission.ownerTitle }}\" for approval on {{ submission.ownerSite }}.\n\n" . + "{% if review.notes %}{{ review.roleName }} Notes: \"{{ review.notes }}\"\n\n{% endif %}" . + "To review it please log into your control panel.\n\n" . + "{{ submission.ownerCpUrl }}", + + 'workflow_editor_review_notification_heading' => 'When a reviewer approves or rejects an editor submission:', + 'workflow_editor_review_notification_subject' => 'Your submission for "{{ submission.ownerTitle }}" has been {{ review.status }} on {{ submission.ownerSite }}.', + 'workflow_editor_review_notification_body' => "Hey {{ user.friendlyName }},\n\n" . + "Your submission for {{ submission.ownerTitle }} has been {{ review.status }} {{ review.dateCreated | date }} on {{ submission.ownerSite }}.\n\n" . + "{% if review.notes %}{{ review.roleName }} Notes: \"{{ review.notes }}\"\n\n{% endif %}" . + "View your submission by logging into your control panel.\n\n" . + "{{ submission.ownerCpUrl }}", + + 'workflow_editor_notification_heading' => 'When a publisher approves or rejects an editor submission:', + 'workflow_editor_notification_subject' => 'Your submission for "{{ submission.ownerTitle }}" has been {{ review.status }} on {{ submission.ownerSite }}.', + 'workflow_editor_notification_body' => "Hey {{ user.friendlyName }},\n\n" . + "Your submission for {{ submission.ownerTitle }} has been {{ review.status }} {{ review.dateCreated | date }} on {{ submission.ownerSite }}.\n\n" . + "{% if review.notes %}{{ review.roleName }} Notes: \"{{ review.notes }}\"\n\n{% endif %}" . + "View your submission by logging into your control panel.\n\n" . + "{{ submission.ownerCpUrl }}", + + 'workflow_published_author_notification_heading' => 'When a publisher approves and publishes an entry to notify the entry author:', + 'workflow_published_author_notification_subject' => 'Your entry "{{ submission.ownerTitle }}" has been published on {{ submission.ownerSite }}.', + 'workflow_published_author_notification_body' => "Hey {{ user.friendlyName }},\n\n" . + "Your entry {{ submission.ownerTitle }} has been published {{ review.dateCreated | date }} on {{ submission.ownerSite }}.\n\n" . + "View your entry by logging into your control panel.\n\n" . + "{{ submission.ownerCpUrl }}", + + 'Action #{num}' => 'Action #{num}', 'Add a user group' => 'Add a user group', 'All' => 'All', @@ -130,18 +165,6 @@ 'Whether publishers are required to enter a note in their submissions.' => 'Whether publishers are required to enter a note in their submissions.', 'Workflow' => 'Workflow', 'Workflow Submissions' => 'Workflow Submissions', - 'workflow_editor_notification_body' => 'workflow_editor_notification_body', - 'workflow_editor_notification_heading' => 'workflow_editor_notification_heading', - 'workflow_editor_notification_subject' => 'workflow_editor_notification_subject', - 'workflow_editor_review_notification_body' => 'workflow_editor_review_notification_body', - 'workflow_editor_review_notification_heading' => 'workflow_editor_review_notification_heading', - 'workflow_editor_review_notification_subject' => 'workflow_editor_review_notification_subject', - 'workflow_published_author_notification_body' => 'workflow_published_author_notification_body', - 'workflow_published_author_notification_heading' => 'workflow_published_author_notification_heading', - 'workflow_published_author_notification_subject' => 'workflow_published_author_notification_subject', - 'workflow_publisher_notification_body' => 'workflow_publisher_notification_body', - 'workflow_publisher_notification_heading' => 'workflow_publisher_notification_heading', - 'workflow_publisher_notification_subject' => 'workflow_publisher_notification_subject', 'You cannot approve your own submission.' => 'You cannot approve your own submission.', '[Deleted element]' => '[Deleted element]', '{role} Notes: “{note}”' => '{role} Notes: “{note}”', From b3011898e6b421328d157793b805013b0d2d3703 Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Sun, 14 Jul 2024 13:19:24 +1000 Subject: [PATCH 3/7] Fix an error when comparing reviews with no data --- src/services/Content.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/Content.php b/src/services/Content.php index beb97cd..b620436 100644 --- a/src/services/Content.php +++ b/src/services/Content.php @@ -36,7 +36,7 @@ public function getContentChangesCounts(Submission $submission): array $nextReview = $reviews[$key + 1] ?? []; if ($nextReview) { - $diff = $differ->doDiff(($nextReview->data ?? []), $review->data); + $diff = $differ->doDiff(($nextReview->data ?? []), ($review->data ?? [])); $content[] = $this->_convertDiffToCount($diff); } From 8a0bf63d9adecb7cd278f1edd124ceb0693b12f1 Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Wed, 17 Jul 2024 15:30:01 +1000 Subject: [PATCH 4/7] Fix an error when comparing reviews with no data --- src/models/Review.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/Review.php b/src/models/Review.php index 2938099..ac62c19 100644 --- a/src/models/Review.php +++ b/src/models/Review.php @@ -141,7 +141,7 @@ public function getUser(): ?User public function getElementRevision(): ?ElementInterface { $element = $this->getElement(); - $attributes = $this->data; + $attributes = $this->data ?? []; $fieldContent = ArrayHelper::remove($attributes, 'fields') ?? []; // The element/draft on the review might've been deleted (applied) @@ -196,7 +196,7 @@ public function hasChanges(): bool $oldReview = Workflow::$plugin->getReviews()->getPreviousReviewById($this->id); if ($oldReview) { - return (bool)Workflow::$plugin->getContent()->getDiff($oldReview->data, $this->data); + return (bool)Workflow::$plugin->getContent()->getDiff($oldReview->data, ($this->data ?? [])); } return false; From d4f918f944167bd6e775119cecf72c7ae6acfab9 Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Thu, 18 Jul 2024 09:57:50 +1000 Subject: [PATCH 5/7] Add editor name to submission dashboard widget items --- src/templates/_widget/body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/_widget/body.html b/src/templates/_widget/body.html index 7860f07..085a720 100644 --- a/src/templates/_widget/body.html +++ b/src/templates/_widget/body.html @@ -6,7 +6,7 @@
{% include '_elements/element' with { element: submission } %} - {{ submission.dateCreated | timestamp('short') }} + {{ submission.dateCreated | timestamp('short') }}: {{ submission.getEditor() }}
{% endfor %} {% else %} From 16e693e56d063865a8dc1f2449964027720257fc Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Fri, 19 Jul 2024 09:17:21 +1000 Subject: [PATCH 6/7] Fix an error when comparing reviews with no data --- src/controllers/ReviewsController.php | 4 ++-- src/models/Review.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/ReviewsController.php b/src/controllers/ReviewsController.php index 7533a85..684b4d4 100644 --- a/src/controllers/ReviewsController.php +++ b/src/controllers/ReviewsController.php @@ -35,7 +35,7 @@ public function actionCompare(?int $newReviewId = null, ?int $oldReviewId = null $variables = [ 'newReview' => $newReview, 'oldReview' => $oldReview, - 'diff' => Workflow::$plugin->getContent()->getDiff($oldReview->data, $newReview->data), + 'diff' => Workflow::$plugin->getContent()->getDiff(($oldReview->data ?? []), ($newReview->data ?? [])), 'title' => "Compare review #{$oldReview->id} to #{$newReview->id}", ]; @@ -82,7 +82,7 @@ public function actionGetCompareModalBody(): Response $html = $view->renderTemplate('workflow/reviews/_compare-modal', [ 'review' => $newReview, - 'diff' => Workflow::$plugin->getContent()->getDiff($oldReview->data, $newReview->data), + 'diff' => Workflow::$plugin->getContent()->getDiff(($oldReview->data ?? []), ($newReview->data ?? [])), ]); $headHtml = $view->getHeadHtml(); diff --git a/src/models/Review.php b/src/models/Review.php index ac62c19..7e5dd10 100644 --- a/src/models/Review.php +++ b/src/models/Review.php @@ -196,7 +196,7 @@ public function hasChanges(): bool $oldReview = Workflow::$plugin->getReviews()->getPreviousReviewById($this->id); if ($oldReview) { - return (bool)Workflow::$plugin->getContent()->getDiff($oldReview->data, ($this->data ?? [])); + return (bool)Workflow::$plugin->getContent()->getDiff(($oldReview->data ?? []), ($this->data ?? [])); } return false; From a14da0f20aa643489c0856317a7dd923f8551c19 Mon Sep 17 00:00:00 2001 From: Josh Crawford Date: Sun, 21 Jul 2024 10:15:44 +1000 Subject: [PATCH 7/7] version 2.0.11 --- CHANGELOG.md | 12 ++++++++++++ composer.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffce8fd..85b060d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 2.0.11 - 2024-07-21 + +### Added +- Add editor name to submission dashboard widget items. + +### Changed +- Update non-English translations. +- Update English translations. + +### Fixed +- Fix an error when comparing reviews with no data. + ## 2.0.10 - 2024-05-18 ### Changed diff --git a/composer.json b/composer.json index 89e7692..446b35f 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "verbb/workflow", "description": "Enforce multi-step review processes for creating entries.", "type": "craft-plugin", - "version": "2.0.10", + "version": "2.0.11", "keywords": [ "craft", "cms",