activity-stream bugfix userid not zero, use the creator

This commit is contained in:
2026-07-08 20:18:38 -03:00
parent d790c73ab5
commit e9fc5df763

View File

@@ -84,14 +84,15 @@ class RecoRecoModel extends Base
} }
// Native wins: if the card became native-recurring, RecoReco yields (decision 13). Leave a // 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). // visible trail in the task's activity stream, attributed to the card's owner (creator_id has
// a FK to users, so a system id like 0 would make the insert fail silently -- no user 0).
if ($task['recurrence_status'] != TaskModel::RECURRING_STATUS_NONE) { if ($task['recurrence_status'] != TaskModel::RECURRING_STATUS_NONE) {
$this->taskMetadataModel->save($task_id, array('recoreco_enabled' => 0)); $this->taskMetadataModel->save($task_id, array('recoreco_enabled' => 0));
$this->logger->info('RecoReco: disabled on task '.$task_id.' (now native-recurring)'); $this->logger->info('RecoReco: disabled on task '.$task_id.' (now native-recurring)');
$this->projectActivityModel->createEvent( $this->projectActivityModel->createEvent(
(int) $task['project_id'], (int) $task['project_id'],
$task_id, $task_id,
0, (int) $task['creator_id'],
'recoreco.task.disable', 'recoreco.task.disable',
array('task' => array('id' => $task_id, 'title' => $task['title'])) array('task' => array('id' => $task_id, 'title' => $task['title']))
); );
@@ -260,11 +261,12 @@ class RecoRecoModel extends Base
$payload = array('source_task_id' => (int) $template['id'], 'new_task_id' => (int) $newId); $payload = array('source_task_id' => (int) $template['id'], 'new_task_id' => (int) $newId);
$this->hook->reference('recoreco:task:spawned', $payload); $this->hook->reference('recoreco:task:spawned', $payload);
// Record the spawn in the clone's activity stream (creator_id 0 = system action). // Record the spawn in the clone's activity stream, attributed to the template's owner
// (creator_id has a FK to users, so a system id like 0 would silently fail the insert).
$this->projectActivityModel->createEvent( $this->projectActivityModel->createEvent(
(int) $template['project_id'], (int) $template['project_id'],
$newId, $newId,
0, (int) $template['creator_id'],
'recoreco.task.spawn', 'recoreco.task.spawn',
array( array(
'task' => array('id' => $newId, 'title' => $template['title']), 'task' => array('id' => $newId, 'title' => $template['title']),