Compare commits
13 Commits
da120f65de
...
5c6ad30005
Author | SHA1 | Date |
---|---|---|
Jurij Podgoršek | 5c6ad30005 | |
Jurij Podgoršek | 843ff7badb | |
Jurij Podgoršek | 4d7c41bd37 | |
Jurij Podgoršek | 212d589909 | |
Jurij Podgoršek | 2be8cf3f60 | |
Jurij Podgoršek | 33c57b8594 | |
Jurij Podgoršek | 1d371e8ec3 | |
Jurij Podgoršek | 8e183c4703 | |
Jurij Podgoršek | 769d6ef1e4 | |
Lio Novelli | 98f6e751e7 | |
Lio Novelli | 1ab9d5f2b5 | |
Lio Novelli | 8767ef606b | |
Lio Novelli | dd0a8de6b2 |
|
@ -20,11 +20,11 @@
|
|||
"drupal/cer": "^5.0@beta",
|
||||
"drupal/config_ignore": "^3.1",
|
||||
"drupal/content_as_config": "^1.0",
|
||||
"drupal/content_moderation_notifications": "^3.6",
|
||||
"drupal/core-composer-scaffold": "^10.0",
|
||||
"drupal/core-project-message": "^10.0",
|
||||
"drupal/core-recommended": "^10.0",
|
||||
"drupal/diff": "^1.1",
|
||||
"drupal/core-recommended": "^10.2.4",
|
||||
"drupal/diff": "^1.1",
|
||||
"drupal/devel": "^5.1",
|
||||
"drupal/gin": "^3.0@RC",
|
||||
"drupal/gin_toolbar": "^1.0@RC",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "caa4d6224baab3b5995203a97dae9c08",
|
||||
"content-hash": "6fdae41d9930b076d636c871454e056b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
|
@ -1726,6 +1726,58 @@
|
|||
"issues": "https://www.drupal.org/project/issues/content_as_config"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "drupal/content_moderation_notifications",
|
||||
"version": "3.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://git.drupalcode.org/project/content_moderation_notifications.git",
|
||||
"reference": "8.x-3.6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://ftp.drupal.org/files/projects/content_moderation_notifications-8.x-3.6.zip",
|
||||
"reference": "8.x-3.6",
|
||||
"shasum": "f475721b95de8d0520053d3101c35c48ea22f61c"
|
||||
},
|
||||
"require": {
|
||||
"drupal/core": "^9 || ^10"
|
||||
},
|
||||
"require-dev": {
|
||||
"drupal/token": "^1.0"
|
||||
},
|
||||
"type": "drupal-module",
|
||||
"extra": {
|
||||
"drupal": {
|
||||
"version": "8.x-3.6",
|
||||
"datestamp": "1695836640",
|
||||
"security-coverage": {
|
||||
"status": "covered",
|
||||
"message": "Covered by Drupal's security advisory policy"
|
||||
}
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packages.drupal.org/8/downloads",
|
||||
"license": [
|
||||
"GPL-2.0+"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "jhedstrom",
|
||||
"homepage": "https://www.drupal.org/user/208732"
|
||||
},
|
||||
{
|
||||
"name": "Rob Holmes",
|
||||
"homepage": "https://www.drupal.org/user/1774034"
|
||||
}
|
||||
],
|
||||
"description": "Manage notifications for content moderation transitions.",
|
||||
"homepage": "https://www.drupal.org/project/content_moderation_notifications",
|
||||
"support": {
|
||||
"source": "https://git.drupalcode.org/project/content_moderation_notifications",
|
||||
"issues": "https://www.drupal.org/project/issues/content_moderation_notifications"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "drupal/core",
|
||||
"version": "10.2.4",
|
||||
|
@ -2183,6 +2235,10 @@
|
|||
"homepage": "https://www.drupal.org/u/realityloop",
|
||||
"role": "Maintainer"
|
||||
},
|
||||
{
|
||||
"name": "Junyor",
|
||||
"homepage": "https://www.drupal.org/user/7006"
|
||||
},
|
||||
{
|
||||
"name": "lhangea",
|
||||
"homepage": "https://www.drupal.org/user/2743803"
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
uuid: ef0653bf-ad20-4659-bb94-9273264eb15b
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: nov_osnutek
|
||||
workflow: concept_workflow
|
||||
transitions:
|
||||
create_new_draft: create_new_draft
|
||||
roles:
|
||||
editor: editor
|
||||
maska: maska
|
||||
author: false
|
||||
site_mail: false
|
||||
emails: ''
|
||||
subject: '[YUFU] New draft of [node:original:title]'
|
||||
body:
|
||||
value: "New draft pending moderation: [node:title] ([node:nid]) by [node:author:mail].\r\n\r\n[node:url]/revisions/view/[node:original:vid]/[node:vid]/visual_inline\r\n\r\n[node:body]"
|
||||
format: plain_text
|
||||
label: 'Nov osnutek'
|
|
@ -0,0 +1,18 @@
|
|||
uuid: c048753b-259e-4210-8e53-031ae5cbae0f
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: spremembe_sprejete
|
||||
workflow: concept_workflow
|
||||
transitions:
|
||||
publish: publish
|
||||
roles:
|
||||
editor: editor
|
||||
author: true
|
||||
site_mail: false
|
||||
emails: ''
|
||||
subject: '[YUFU] Changes approved'
|
||||
body:
|
||||
value: 'Proposed changes to [node:title] ([node:url]) by [node:author:mail] were approved.'
|
||||
format: plain_text
|
||||
label: 'Spremembe sprejete'
|
|
@ -14,6 +14,7 @@ module:
|
|||
config_translation: 0
|
||||
content_as_config: 0
|
||||
content_moderation: 0
|
||||
content_moderation_notifications: 0
|
||||
contextual: 0
|
||||
datetime: 0
|
||||
dblog: 0
|
||||
|
|
|
@ -15,10 +15,10 @@ display:
|
|||
exposed_form:
|
||||
options:
|
||||
submit_button: Primjeni
|
||||
reset_button_label: Poništi
|
||||
reset_button_label: Ponastavi
|
||||
exposed_sorts_label: 'Rasporedi po'
|
||||
sort_asc_label: Uzlazno
|
||||
sort_desc_label: Silazno
|
||||
sort_asc_label: Naraščajoče
|
||||
sort_desc_label: Padajoče
|
||||
empty:
|
||||
area_text_custom:
|
||||
content: 'There are no custom blocks available.'
|
||||
|
|
|
@ -27,10 +27,10 @@ display:
|
|||
exposed_form:
|
||||
options:
|
||||
submit_button: Počisti
|
||||
reset_button_label: Poništi
|
||||
reset_button_label: Ponastavi
|
||||
exposed_sorts_label: 'Rasporedi po'
|
||||
sort_asc_label: Uzlazno
|
||||
sort_desc_label: Silazno
|
||||
sort_asc_label: Naraščajoče
|
||||
sort_desc_label: Padajoče
|
||||
empty:
|
||||
area_text_custom:
|
||||
content: 'Nema dostupnih komentara.'
|
||||
|
|
|
@ -22,10 +22,10 @@ display:
|
|||
exposed_form:
|
||||
options:
|
||||
submit_button: Počisti
|
||||
reset_button_label: Poništi
|
||||
reset_button_label: Ponastavi
|
||||
exposed_sorts_label: 'Rasporedi po'
|
||||
sort_asc_label: Uzlazno
|
||||
sort_desc_label: Silazno
|
||||
sort_asc_label: Naraščajoče
|
||||
sort_desc_label: Padajoče
|
||||
filters:
|
||||
bundle:
|
||||
expose:
|
||||
|
|
|
@ -8,10 +8,10 @@ display:
|
|||
action_title: Akcija
|
||||
exposed_form:
|
||||
options:
|
||||
reset_button_label: Poništi
|
||||
reset_button_label: Ponastavi
|
||||
exposed_sorts_label: 'Rasporedi po'
|
||||
sort_asc_label: Uzlazno
|
||||
sort_desc_label: Silazno
|
||||
sort_asc_label: Naraščajoče
|
||||
sort_desc_label: Padajoče
|
||||
filters:
|
||||
status:
|
||||
group_info:
|
||||
|
|
|
@ -6,10 +6,10 @@ display:
|
|||
exposed_form:
|
||||
options:
|
||||
submit_button: Primjeni
|
||||
reset_button_label: Poništi
|
||||
reset_button_label: Ponastavi
|
||||
exposed_sorts_label: 'Rasporedi po'
|
||||
sort_asc_label: Uzlazno
|
||||
sort_desc_label: Silazno
|
||||
sort_asc_label: Naraščajoče
|
||||
sort_desc_label: Padajoče
|
||||
arguments:
|
||||
tid:
|
||||
exception:
|
||||
|
|
|
@ -371,11 +371,11 @@ display:
|
|||
options:
|
||||
submit_button: Počisti
|
||||
reset_button: true
|
||||
reset_button_label: Poništi
|
||||
reset_button_label: Ponastavi
|
||||
exposed_sorts_label: 'Rasporedi po'
|
||||
expose_sort_order: true
|
||||
sort_asc_label: Uzlazno
|
||||
sort_desc_label: Silazno
|
||||
sort_asc_label: Naraščajoče
|
||||
sort_desc_label: Padajoče
|
||||
access:
|
||||
type: perm
|
||||
options:
|
||||
|
|
|
@ -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;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -8,7 +8,6 @@ use Drupal\Core\StringTranslation\StringTranslationTrait;
|
|||
use Drupal\Core\TypedData\Exception\MissingDataException;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\rest\Plugin\ResourceBase;
|
||||
use Drupal\rest\ResourceResponse;
|
||||
use Psr\Log\LogLevel;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
@ -101,7 +100,7 @@ class AddConcept extends ResourceBase {
|
|||
* @param \Symfony\Component\HttpFoundation\Request;
|
||||
* Post request.
|
||||
*
|
||||
* @return \Drupal\rest\ResourceResponse
|
||||
* @return \Symfony\Component\HttpFoundation\JsonResponse
|
||||
* Returns rest resource.
|
||||
*/
|
||||
public function post(Request $request) {
|
||||
|
@ -124,6 +123,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', array_reverse($uids));
|
||||
}
|
||||
$concept->isDefaultRevision(FALSE);
|
||||
$concept->setRevisionLogMessage('New revision by concept endpoint.');
|
||||
$concept->set('moderation_state', 'draft');
|
||||
|
@ -163,7 +167,6 @@ class AddConcept extends ResourceBase {
|
|||
'revision_uid' => $concept->getRevisionUserId(),
|
||||
'uid' => $concept->uid->target_id,
|
||||
];
|
||||
// $response = new ResourceResponse($response_status);
|
||||
$response = new JsonResponse($response_status);
|
||||
return $response;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\node\NodeInterface;
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Primary module hooks for Yufu Concept module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_entity_update().
|
||||
*/
|
||||
function yufu_concept_node_presave(EntityInterface $entity) {
|
||||
if ($entity instanceOf NodeInterface && $entity->bundle() == 'concept') {
|
||||
$transition = \Drupal::service('content_moderation_notifications.notification_information')->getTransition($entity);
|
||||
if ($transition->id() == 'publish') {
|
||||
if ($user = $entity->uid->entity) {
|
||||
if (!$user->status->value) {
|
||||
$user->set('status', 1);
|
||||
$user->addRole('editor');
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue