Fixanje posiljanja prek mailov. Izkljuci yufu admin
parent
dd0a8de6b2
commit
8767ef606b
|
@ -12,7 +12,7 @@ roles:
|
|||
author: false
|
||||
site_mail: false
|
||||
emails: ''
|
||||
subject: 'New draft [node:title]'
|
||||
subject: '[YUFU] New draft [node:title]'
|
||||
body:
|
||||
value: "New draft pedning moderation: [node:title] ([node:nid]) by [node:author:email].\r\n\r\n[node:url]\r\n\r\n[node:body]"
|
||||
format: plain_text
|
||||
|
|
|
@ -10,7 +10,7 @@ roles: { }
|
|||
author: true
|
||||
site_mail: false
|
||||
emails: ''
|
||||
subject: 'Yufu changes approved'
|
||||
subject: '[YUFU] Changes approved'
|
||||
body:
|
||||
value: 'Your proposed changes to [node:title] ([node:url]) were approved.'
|
||||
format: plain_text
|
||||
|
|
|
@ -57,39 +57,39 @@ function yufu_admin_mail($key, &$message, $params) {
|
|||
/**
|
||||
* Implements hook_ENTITY_TYPE_presave().
|
||||
*/
|
||||
function yufu_admin_node_presave(EntityInterface $entity) {
|
||||
if ($entity instanceOf NodeInterface && $entity->bundle() == 'concept') {
|
||||
// Get transition: concept_drafted, concept_approved, concept_rejected.
|
||||
if ($entity->isNew()) {
|
||||
$transition = 'concept_drafted';
|
||||
}
|
||||
else {
|
||||
$transition = _yufu_admin_get_node_transition($entity);
|
||||
}
|
||||
switch ($transition) {
|
||||
case 'stay_draft':
|
||||
case 'concept_drafted':
|
||||
// Send email to editors.
|
||||
$params = _yufu_admin_concept_drafted_mail($entity);
|
||||
$result = _yufu_admin_send_email($transition, $params['to'], $params);
|
||||
_yufu_admin_status_message($result['result'], $transition, $entity, $params['to']);
|
||||
break;
|
||||
case 'concept_approved':
|
||||
// Send email to revision creator (user).
|
||||
// @TODO Maybe notify other editors.
|
||||
$params = _yufu_admin_concept_approved_get_message($entity);
|
||||
$result = _yufu_admin_send_email($transition, $params['to'], $params);
|
||||
_yufu_admin_status_message($result['result'], $transition, $entity, $params['to']);
|
||||
break;
|
||||
case 'concept_rejectd':
|
||||
// Send email to revision creator (user).
|
||||
// This transition happens on revision delete.
|
||||
// Curently it is dead.
|
||||
// @TODO https://git.kompot.si/yufu/manifest/issues/45
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// function yufu_admin_node_presave(EntityInterface $entity) {
|
||||
// if ($entity instanceOf NodeInterface && $entity->bundle() == 'concept') {
|
||||
// // Get transition: concept_drafted, concept_approved, concept_rejected.
|
||||
// if ($entity->isNew()) {
|
||||
// $transition = 'concept_drafted';
|
||||
// }
|
||||
// else {
|
||||
// $transition = _yufu_admin_get_node_transition($entity);
|
||||
// }
|
||||
// switch ($transition) {
|
||||
// case 'stay_draft':
|
||||
// case 'concept_drafted':
|
||||
// // Send email to editors.
|
||||
// $params = _yufu_admin_concept_drafted_mail($entity);
|
||||
// $result = _yufu_admin_send_email($transition, $params['to'], $params);
|
||||
// _yufu_admin_status_message($result['result'], $transition, $entity, $params['to']);
|
||||
// break;
|
||||
// case 'concept_approved':
|
||||
// // Send email to revision creator (user).
|
||||
// // @TODO Maybe notify other editors.
|
||||
// $params = _yufu_admin_concept_approved_get_message($entity);
|
||||
// $result = _yufu_admin_send_email($transition, $params['to'], $params);
|
||||
// _yufu_admin_status_message($result['result'], $transition, $entity, $params['to']);
|
||||
// break;
|
||||
// case 'concept_rejectd':
|
||||
// // Send email to revision creator (user).
|
||||
// // This transition happens on revision delete.
|
||||
// // Curently it is dead.
|
||||
// // @TODO https://git.kompot.si/yufu/manifest/issues/45
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* Compare original node moderation state with current state.
|
||||
|
@ -276,3 +276,15 @@ function _yufu_admin_get_all_pioneer_emails() {
|
|||
// @TODO: Think it through if it is really needed.
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke hook_content_moderation_notification_mail_data_alter().
|
||||
*/
|
||||
// function yufu_admin_content_moderation_notification_mail_data_alter(EntityInterface $entity, array &$data) {
|
||||
// // Add an extra email address to the list.
|
||||
// if ($entity instanceOf NodeInterface) {
|
||||
// if ($email = _yufu_admin_get_pioneer_email($entity)) {
|
||||
// $data['to'][] = $email;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -124,6 +124,11 @@ class AddConcept extends ResourceBase {
|
|||
$concept->setRevisionUserId($uid);
|
||||
$concept->set('title', $data['title']);
|
||||
$concept->set('body', $data['text'] ?? $concept->body->value);
|
||||
if ($uid) {
|
||||
$uids = $concept->get('uid')->getValue();
|
||||
$uids[] = ['target_id' => $uid];
|
||||
$concept->set('uid', $uids);
|
||||
}
|
||||
$concept->isDefaultRevision(FALSE);
|
||||
$concept->setRevisionLogMessage('New revision by concept endpoint.');
|
||||
$concept->set('moderation_state', 'draft');
|
||||
|
|
Loading…
Reference in New Issue