Improve email messages.

Lio Novelli 2024-03-10 22:48:32 +01:00
parent f3dcea005f
commit 2a02860803
1 changed files with 15 additions and 8 deletions

View File

@ -44,12 +44,12 @@ function yufu_admin_mail($key, &$message, $params) {
break;
case 'concept_approved':
$message['from'] = \Drupal::config('system.site')->get('mail');
$message['subject'] = t('[YUFU] Your concept (changes) were approved: @title', ['@title' => $params['node_title']], $options);
$message['subject'] = t('[YUFU] Concept changes approved: @title', ['@title' => $params['node_title']], $options);
$message['body'][] = $params['message'];
break;
case 'concept_rejected':
$message['from'] = \Drupal::config('system.site')->get('mail');
$message['subject'] = t('[YUFU] Your concept (changes) were rejected: @title', ['@title' => $params['node_title']], $options);
$message['subject'] = t('[YUFU] Concept changes rejected: @title', ['@title' => $params['node_title']], $options);
$message['body'][] = $params['message'];
}
}
@ -127,10 +127,18 @@ function _yufu_admin_get_node_transition(NodeInterface $node) {
*/
function _yufu_admin_concept_drafted_mail(NodeInterface $node) {
$to = _yufu_admin_get_all_editors_emails();
$params['message'] = t('New concept created: @title - @url', [
'@title' => $node->getTitle(),
'@url' => !$node->isNew() ? $node?->toUrl()?->toString() : '',
]);
if ($node->isNew()) {
$params['message'] = t('New concept created: @title - @url', [
'@title' => $node->getTitle(),
'@url' => !$node->isNew() ? $node?->toUrl()?->toString() : '',
]);
}
else {
$params['message'] = t('New changes to concept proposed: @title - @url', [
'@title' => $node->getTitle(),
'@url' => !$node->isNew() ? $node?->toUrl()?->toString() : '',
]);
}
$params['node_title'] = $node->getTitle();
$params['to'] = implode(',', $to);
return $params;
@ -220,8 +228,7 @@ function _yufu_admin_concept_approved_get_message(NodeInterface $node) {
// @TODO - to make this work properly, we should get a list of all authors of
// unpublished revisions so far since the last published revision.
if ($to = _yufu_admin_get_pioneer_email($node)) {
// @TODO Dodamo se avtorja v sporocilo?
$params['message'] = t('New concept created: @title - @url', [
$params['message'] = t('Your proposal of changes to concept were approved: @title - @url', [
'@title' => $node->getTitle(),
'@url' => $node?->toUrl()?->toString() ?? '',
]);