diff --git a/Model/RecoRecoModel.php b/Model/RecoRecoModel.php index 8e81639..456945f 100644 --- a/Model/RecoRecoModel.php +++ b/Model/RecoRecoModel.php @@ -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; } diff --git a/Plugin.php b/Plugin.php index 119ec60..fe697a8 100644 --- a/Plugin.php +++ b/Plugin.php @@ -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/, 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() diff --git a/Template/event/recoreco_task_disable.php b/Template/event/recoreco_task_disable.php new file mode 100644 index 0000000..2180a21 --- /dev/null +++ b/Template/event/recoreco_task_disable.php @@ -0,0 +1,9 @@ +

+ url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'])) + ) ?> + dt->datetime($date_creation) ?> +

+
+

text->e($task['title']) ?>

+
diff --git a/Template/event/recoreco_task_spawn.php b/Template/event/recoreco_task_spawn.php new file mode 100644 index 0000000..2880dcf --- /dev/null +++ b/Template/event/recoreco_task_spawn.php @@ -0,0 +1,10 @@ +

+ 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)) + ) ?> + dt->datetime($date_creation) ?> +

+
+

text->e($task['title']) ?>

+
diff --git a/VERSION b/VERSION index 12ab6d5..3bdc365 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -RecoReco v1.4 +RecoReco v1.5