fix: [outboxProcessor:generic] Added support of severity
parent
be7293a5a4
commit
1626037239
|
@ -20,9 +20,14 @@ class GenericOutboxProcessor
|
||||||
protected $validator;
|
protected $validator;
|
||||||
protected $processingTemplate = '/genericTemplates/confirm';
|
protected $processingTemplate = '/genericTemplates/confirm';
|
||||||
protected $processingTemplatesDirectory = ROOT . '/libraries/default/OutboxProcessors/templates';
|
protected $processingTemplatesDirectory = ROOT . '/libraries/default/OutboxProcessors/templates';
|
||||||
|
protected $defaultSeverity;
|
||||||
|
protected $severity;
|
||||||
|
|
||||||
|
|
||||||
public function __construct($registerActions=false) {
|
public function __construct($registerActions=false) {
|
||||||
$this->Outbox = TableRegistry::getTableLocator()->get('Outbox');
|
$this->Outbox = TableRegistry::getTableLocator()->get('Outbox');
|
||||||
|
$this->Inbox = TableRegistry::getTableLocator()->get('Inbox');
|
||||||
|
$this->defaultSeverity = $this->Inbox::SEVERITY_INFO;
|
||||||
if ($registerActions) {
|
if ($registerActions) {
|
||||||
$this->registerActionInProcessor();
|
$this->registerActionInProcessor();
|
||||||
}
|
}
|
||||||
|
@ -55,6 +60,10 @@ class GenericOutboxProcessor
|
||||||
{
|
{
|
||||||
return $this->description ?? '';
|
return $this->description ?? '';
|
||||||
}
|
}
|
||||||
|
public function getSeverity()
|
||||||
|
{
|
||||||
|
return $this->severity ?? $this->defaultSeverity;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getProcessingTemplatePath()
|
protected function getProcessingTemplatePath()
|
||||||
{
|
{
|
||||||
|
@ -77,8 +86,9 @@ class GenericOutboxProcessor
|
||||||
$builder = new ViewBuilder();
|
$builder = new ViewBuilder();
|
||||||
$builder->disableAutoLayout()
|
$builder->disableAutoLayout()
|
||||||
->setClassName('Monad')
|
->setClassName('Monad')
|
||||||
->setTemplate($processingTemplate);
|
->setTemplate($processingTemplate)
|
||||||
$view = $builder->build($viewVariables);
|
->setVars($viewVariables);
|
||||||
|
$view = $builder->build();
|
||||||
$view->setRequest($serverRequest);
|
$view->setRequest($serverRequest);
|
||||||
return $view->render();
|
return $view->render();
|
||||||
}
|
}
|
||||||
|
@ -193,6 +203,7 @@ class GenericOutboxProcessor
|
||||||
$user_id = Router::getRequest()->getSession()->read('Auth.id');
|
$user_id = Router::getRequest()->getSession()->read('Auth.id');
|
||||||
$requestData['scope'] = $this->scope;
|
$requestData['scope'] = $this->scope;
|
||||||
$requestData['action'] = $this->action;
|
$requestData['action'] = $this->action;
|
||||||
|
$requestData['severity'] = $this->getSeverity();
|
||||||
$requestData['user_id'] = $user_id;
|
$requestData['user_id'] = $user_id;
|
||||||
$request = $this->generateRequest($requestData);
|
$request = $this->generateRequest($requestData);
|
||||||
$savedRequest = $this->Outbox->createEntry($request);
|
$savedRequest = $this->Outbox->createEntry($request);
|
||||||
|
|
Loading…
Reference in New Issue