Skip to content

Commit

Permalink
Fix an error with sending published author notification emails
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Feb 11, 2023
1 parent 00e6f2a commit 89f91c5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
45 changes: 27 additions & 18 deletions src/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,33 @@ private function _registerCpRoutes(): void
private function _registerEmailMessages(): void
{
Event::on(SystemMessages::class, SystemMessages::EVENT_REGISTER_MESSAGES, function(RegisterEmailMessagesEvent $event): void {
$event->messages = array_merge($event->messages, [
[
'key' => 'workflow_publisher_notification',
'heading' => Craft::t('workflow', 'workflow_publisher_notification_heading'),
'subject' => Craft::t('workflow', 'workflow_publisher_notification_subject'),
'body' => Craft::t('workflow', 'workflow_publisher_notification_body'),
], [
'key' => 'workflow_editor_review_notification',
'heading' => Craft::t('workflow', 'workflow_editor_review_notification_heading'),
'subject' => Craft::t('workflow', 'workflow_editor_review_notification_subject'),
'body' => Craft::t('workflow', 'workflow_editor_review_notification_body'),
], [
'key' => 'workflow_editor_notification',
'heading' => Craft::t('workflow', 'workflow_editor_notification_heading'),
'subject' => Craft::t('workflow', 'workflow_editor_notification_subject'),
'body' => Craft::t('workflow', 'workflow_editor_notification_body'),
],
]);
$event->messages[] = [
'key' => 'workflow_publisher_notification',
'heading' => Craft::t('workflow', 'workflow_publisher_notification_heading'),
'subject' => Craft::t('workflow', 'workflow_publisher_notification_subject'),
'body' => Craft::t('workflow', 'workflow_publisher_notification_body'),
];

$event->messages[] = [
'key' => 'workflow_editor_review_notification',
'heading' => Craft::t('workflow', 'workflow_editor_review_notification_heading'),
'subject' => Craft::t('workflow', 'workflow_editor_review_notification_subject'),
'body' => Craft::t('workflow', 'workflow_editor_review_notification_body'),
];

$event->messages[] = [
'key' => 'workflow_editor_notification',
'heading' => Craft::t('workflow', 'workflow_editor_notification_heading'),
'subject' => Craft::t('workflow', 'workflow_editor_notification_subject'),
'body' => Craft::t('workflow', 'workflow_editor_notification_body'),
];

$event->messages[] = [
'key' => 'workflow_published_author_notification',
'heading' => Craft::t('workflow', 'workflow_published_author_notification_heading'),
'subject' => Craft::t('workflow', 'workflow_published_author_notification_subject'),
'body' => Craft::t('workflow', 'workflow_published_author_notification_body'),
];
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/Emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public function sendPublishedAuthorNotificationEmail(Submission $submission, Rev
}

try {
$mail = Craft::$app->getMailer()->composeFromKey('workflow_author_published_notification', [
$mail = Craft::$app->getMailer()->composeFromKey('workflow_published_author_notification', [
'submission' => $submission,
'review' => $review,
]);
Expand Down

0 comments on commit 89f91c5

Please sign in to comment.