Repository navigation
[6.x] Name untitled drafts in workflow notifications - #20465
Open
brandonkelly wants to merge 1 commit into
Open
brandonkelly wants to merge 1 commit into
brandonkelly wants to merge 1 commit into
Conversation
Workflow notifications interpolated the draft's title, which is empty for drafts that don't have one yet, such as new entries submitted for review before they were titled. Use the draft's UI label instead, which falls back to “Untitled entry” and respects UI label formats. Amp-Thread-ID: https://ampcode.com/threads/T-01a1b7ff-d0c0-77c2-9643-6ab03a5ec1ad Co-authored-by: Amp <amp@ampcode.com>
📚 Storybook previews@craftcms/ui — open Storybook No changed components detected in this Storybook. resources/js — open Storybook No changed components detected in this Storybook. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Workflow notifications named the entry with
$draft->title, which is empty when a draft has no title yet. A new entry can be saved as a draft and submitted for review without one, because draft saves use the essentials scenario. Reviewers then got “” is awaiting your approval in Review. Notifications now use the draft's UI label, which is what the control panel shows elsewhere. It falls back to “Untitled entry” and respects entry types' UI label formats.SendUserReviewNotifications t('“{entry}” is awaiting your approval in {stage}.', [ - 'entry' => $event->draft->title, + 'entry' => $event->draft->getUiLabel(), ]) // same for approved, changes requested, commented, reset, and the email's {{ entry }}Titled drafts are unchanged. Draft names (“Draft 1”) were never part of these messages.
Evidence
tests/Feature/Workflow/WorkflowsTest.php: names untitled drafts in review notifications'“” is awaiting your approval in Review.'tests/Feature/Workflowpasses (59 tests).