activity-stream entries for spawn and native-recurrence self-disable v1.5
This commit is contained in:
@@ -83,10 +83,18 @@ class RecoRecoModel extends Base
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Native wins: if the card became native-recurring, RecoReco yields (decision 13).
|
||||
// Native wins: if the card became native-recurring, RecoReco yields (decision 13). Leave a
|
||||
// visible trail in the task's activity stream (creator_id 0 = system action).
|
||||
if ($task['recurrence_status'] != TaskModel::RECURRING_STATUS_NONE) {
|
||||
$this->taskMetadataModel->save($task_id, array('recoreco_enabled' => 0));
|
||||
$this->logger->info('RecoReco: disabled on task '.$task_id.' (now native-recurring)');
|
||||
$this->projectActivityModel->createEvent(
|
||||
(int) $task['project_id'],
|
||||
$task_id,
|
||||
0,
|
||||
'recoreco.task.disable',
|
||||
array('task' => array('id' => $task_id, 'title' => $task['title']))
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -252,6 +260,19 @@ class RecoRecoModel extends Base
|
||||
$payload = array('source_task_id' => (int) $template['id'], 'new_task_id' => (int) $newId);
|
||||
$this->hook->reference('recoreco:task:spawned', $payload);
|
||||
|
||||
// Record the spawn in the clone's activity stream (creator_id 0 = system action).
|
||||
$this->projectActivityModel->createEvent(
|
||||
(int) $template['project_id'],
|
||||
$newId,
|
||||
0,
|
||||
'recoreco.task.spawn',
|
||||
array(
|
||||
'task' => array('id' => $newId, 'title' => $template['title']),
|
||||
'template_id' => (int) $template['id'],
|
||||
'template_title' => $template['title'],
|
||||
)
|
||||
);
|
||||
|
||||
return $newId;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,12 @@ class Plugin extends Base
|
||||
// the same scheduler pass as cron. Admin-only for free via the shared 'ConfigController' ACL.
|
||||
$this->template->hook->attach('template:config:sidebar', 'recoReco:config/sidebar');
|
||||
|
||||
// Activity-stream entries. The feed renders each event via event/<name-with-underscores>, so
|
||||
// map our two event names to the plugin templates (a spawn on the new card, and the yield to
|
||||
// native recurrence on the template). createEvent() writes the rows directly from the model.
|
||||
$this->template->setTemplateOverride('event/recoreco_task_spawn', 'recoReco:event/recoreco_task_spawn');
|
||||
$this->template->setTemplateOverride('event/recoreco_task_disable', 'recoReco:event/recoreco_task_disable');
|
||||
|
||||
// The scheduling engine runs from the CLI (cron). Registered CLI-only so web requests do
|
||||
// not build the console app.
|
||||
if (php_sapi_name() === 'cli') {
|
||||
@@ -55,7 +61,7 @@ class Plugin extends Base
|
||||
|
||||
public function getPluginVersion()
|
||||
{
|
||||
return '1.4.0';
|
||||
return '1.5.0';
|
||||
}
|
||||
|
||||
public function getPluginHomepage()
|
||||
|
||||
9
Template/event/recoreco_task_disable.php
Normal file
9
Template/event/recoreco_task_disable.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<p class="activity-title">
|
||||
<?= e('RecoReco disabled recurrence on %s -- the card now uses Kanboard built-in recurrence',
|
||||
$this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id']))
|
||||
) ?>
|
||||
<small class="activity-date"><?= $this->dt->datetime($date_creation) ?></small>
|
||||
</p>
|
||||
<div class="activity-description">
|
||||
<p class="activity-task-title"><?= $this->text->e($task['title']) ?></p>
|
||||
</div>
|
||||
10
Template/event/recoreco_task_spawn.php
Normal file
10
Template/event/recoreco_task_spawn.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<p class="activity-title">
|
||||
<?= e('RecoReco created %s from the recurring template %s',
|
||||
$this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'])),
|
||||
$this->url->link($this->text->e($template_title), 'TaskViewController', 'show', array('task_id' => $template_id))
|
||||
) ?>
|
||||
<small class="activity-date"><?= $this->dt->datetime($date_creation) ?></small>
|
||||
</p>
|
||||
<div class="activity-description">
|
||||
<p class="activity-task-title"><?= $this->text->e($task['title']) ?></p>
|
||||
</div>
|
||||
Reference in New Issue
Block a user