Subtasks events refactoring and show delete in activity stream
This commit is contained in:
@@ -66,10 +66,6 @@ class NotificationJob extends BaseJob
|
||||
case 'Kanboard\Event\TaskEvent':
|
||||
$values['task'] = $this->taskFinderModel->getDetails($event['task_id']);
|
||||
break;
|
||||
case 'Kanboard\Event\SubtaskEvent':
|
||||
$values['subtask'] = $this->subtaskModel->getById($event['id'], true);
|
||||
$values['task'] = $this->taskFinderModel->getDetails($values['subtask']['task_id']);
|
||||
break;
|
||||
default:
|
||||
$values = $event;
|
||||
}
|
||||
|
||||
48
app/Job/SubtaskEventJob.php
Normal file
48
app/Job/SubtaskEventJob.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Job;
|
||||
|
||||
use Kanboard\EventBuilder\SubtaskEventBuilder;
|
||||
|
||||
/**
|
||||
* Class SubtaskEventJob
|
||||
*
|
||||
* @package Kanboard\Job
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class SubtaskEventJob extends BaseJob
|
||||
{
|
||||
/**
|
||||
* Set job params
|
||||
*
|
||||
* @param int $subtaskId
|
||||
* @param string $eventName
|
||||
* @param array $values
|
||||
* @return $this
|
||||
*/
|
||||
public function withParams($subtaskId, $eventName, array $values = array())
|
||||
{
|
||||
$this->jobParams = array($subtaskId, $eventName, $values);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute job
|
||||
*
|
||||
* @param int $subtaskId
|
||||
* @param string $eventName
|
||||
* @param array $values
|
||||
* @return $this
|
||||
*/
|
||||
public function execute($subtaskId, $eventName, array $values = array())
|
||||
{
|
||||
$event = SubtaskEventBuilder::getInstance($this->container)
|
||||
->withSubtaskId($subtaskId)
|
||||
->withValues($values)
|
||||
->build();
|
||||
|
||||
if ($event !== null) {
|
||||
$this->dispatcher->dispatch($eventName, $event);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user