From 390082aa41cb81610089163b1cc3a256f3b3c513 Mon Sep 17 00:00:00 2001
From: Frederic Guillot
Date: Tue, 19 Jul 2016 22:38:30 -0400
Subject: Refactoring of internal task events
---
tests/units/Action/BaseActionTest.php | 10 ++---
.../Action/CommentCreationMoveTaskColumnTest.php | 6 +--
tests/units/Action/TaskAssignCategoryColorTest.php | 18 +++++++--
tests/units/Action/TaskAssignCategoryLinkTest.php | 43 +++++++++++-----------
tests/units/Action/TaskAssignColorCategoryTest.php | 18 +++++++--
tests/units/Action/TaskAssignColorColumnTest.php | 18 +++++++--
tests/units/Action/TaskAssignColorPriorityTest.php | 18 +++++++--
tests/units/Action/TaskAssignColorUserTest.php | 18 +++++++--
.../Action/TaskAssignCurrentUserColumnTest.php | 26 +++++++++++--
tests/units/Action/TaskAssignSpecificUserTest.php | 17 ++++++++-
tests/units/Action/TaskCloseColumnTest.php | 18 +++++++--
tests/units/Action/TaskCloseTest.php | 15 ++++++--
.../Action/TaskDuplicateAnotherProjectTest.php | 18 +++++++--
tests/units/Action/TaskEmailTest.php | 19 ++++++++--
tests/units/Action/TaskMoveAnotherProjectTest.php | 17 ++++++++-
tests/units/Action/TaskMoveColumnAssignedTest.php | 18 +++++++--
.../Action/TaskMoveColumnCategoryChangeTest.php | 31 ++++++++++++++--
.../units/Action/TaskMoveColumnUnAssignedTest.php | 31 ++++++++++++++--
tests/units/Action/TaskOpenTest.php | 15 ++++++--
tests/units/Action/TaskUpdateStartDateTest.php | 17 ++++++++-
20 files changed, 308 insertions(+), 83 deletions(-)
(limited to 'tests/units/Action')
diff --git a/tests/units/Action/BaseActionTest.php b/tests/units/Action/BaseActionTest.php
index 1d50c70e..feeba3f9 100644
--- a/tests/units/Action/BaseActionTest.php
+++ b/tests/units/Action/BaseActionTest.php
@@ -23,7 +23,7 @@ class DummyAction extends Kanboard\Action\Base
public function getEventRequiredParameters()
{
- return array('p1', 'p2');
+ return array('p1', 'p2', 'p3' => array('p4'));
}
public function doAction(array $data)
@@ -60,7 +60,7 @@ class BaseActionTest extends Base
public function testGetEventRequiredParameters()
{
$dummyAction = new DummyAction($this->container);
- $this->assertEquals(array('p1', 'p2'), $dummyAction->getEventRequiredParameters());
+ $this->assertEquals(array('p1', 'p2', 'p3' => array('p4')), $dummyAction->getEventRequiredParameters());
}
public function testGetCompatibleEvents()
@@ -113,7 +113,7 @@ class BaseActionTest extends Base
$dummyAction = new DummyAction($this->container);
$dummyAction->setProjectId(1234);
- $this->assertTrue($dummyAction->hasRequiredParameters(array('p1' => 12, 'p2' => 34)));
+ $this->assertTrue($dummyAction->hasRequiredParameters(array('p1' => 12, 'p2' => 34, 'p3' => array('p4' => 'foobar'))));
$this->assertFalse($dummyAction->hasRequiredParameters(array('p1' => 12)));
$this->assertFalse($dummyAction->hasRequiredParameters(array()));
}
@@ -125,7 +125,7 @@ class BaseActionTest extends Base
$dummyAction->addEvent('my.event', 'My Event Overrided');
$events = $dummyAction->getEvents();
- $this->assertcount(2, $events);
+ $this->assertCount(2, $events);
$this->assertEquals(array('my.event', 'foobar'), $events);
}
@@ -136,7 +136,7 @@ class BaseActionTest extends Base
$dummyAction->setParam('p1', 'something');
$dummyAction->addEvent('foobar', 'FooBar');
- $event = new GenericEvent(array('project_id' => 1234, 'p1' => 'something', 'p2' => 'abc'));
+ $event = new GenericEvent(array('project_id' => 1234, 'p1' => 'something', 'p2' => 'abc', 'p3' => array('p4' => 'a')));
$this->assertTrue($dummyAction->execute($event, 'foobar'));
$this->assertFalse($dummyAction->execute($event, 'foobar'));
diff --git a/tests/units/Action/CommentCreationMoveTaskColumnTest.php b/tests/units/Action/CommentCreationMoveTaskColumnTest.php
index 5eaf515e..b3d21287 100644
--- a/tests/units/Action/CommentCreationMoveTaskColumnTest.php
+++ b/tests/units/Action/CommentCreationMoveTaskColumnTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskModel;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\CommentModel;
@@ -22,7 +22,7 @@ class CommentCreationMoveTaskColumnTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array('task' => array('project_id' => 1, 'column_id' => 2), 'task_id' => 1));
$action = new CommentCreationMoveTaskColumn($this->container);
$action->setProjectId(1);
@@ -45,7 +45,7 @@ class CommentCreationMoveTaskColumnTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3));
+ $event = new TaskEvent(array('task' => array('project_id' => 1, 'column_id' => 3), 'task_id' => 1));
$action = new CommentCreationMoveTaskColumn($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskAssignCategoryColorTest.php b/tests/units/Action/TaskAssignCategoryColorTest.php
index 09c08264..5a0f7d03 100644
--- a/tests/units/Action/TaskAssignCategoryColorTest.php
+++ b/tests/units/Action/TaskAssignCategoryColorTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\CategoryModel;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
@@ -23,7 +23,13 @@ class TaskAssignCategoryColorTest extends Base
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
$this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1)));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'color_id' => 'red'));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'color_id' => 'red',
+ )
+ ));
$action = new TaskAssignCategoryColor($this->container);
$action->setProjectId(1);
@@ -47,7 +53,13 @@ class TaskAssignCategoryColorTest extends Base
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
$this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1)));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'color_id' => 'blue'));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'color_id' => 'blue',
+ )
+ ));
$action = new TaskAssignCategoryColor($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskAssignCategoryLinkTest.php b/tests/units/Action/TaskAssignCategoryLinkTest.php
index 712c3c02..d7e68f72 100644
--- a/tests/units/Action/TaskAssignCategoryLinkTest.php
+++ b/tests/units/Action/TaskAssignCategoryLinkTest.php
@@ -14,19 +14,19 @@ class TaskAssignCategoryLinkTest extends Base
{
public function testAssignCategory()
{
- $tc = new TaskCreationModel($this->container);
- $tf = new TaskFinderModel($this->container);
- $p = new ProjectModel($this->container);
- $c = new CategoryModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $categoryModel = new CategoryModel($this->container);
$action = new TaskAssignCategoryLink($this->container);
$action->setProjectId(1);
$action->setParam('category_id', 1);
$action->setParam('link_id', 2);
- $this->assertEquals(1, $p->create(array('name' => 'P1')));
- $this->assertEquals(1, $c->create(array('name' => 'C1', 'project_id' => 1)));
- $this->assertEquals(1, $tc->create(array('title' => 'T1', 'project_id' => 1)));
+ $this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
+ $this->assertEquals(1, $categoryModel->create(array('name' => 'C1', 'project_id' => 1)));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'T1', 'project_id' => 1)));
$event = new TaskLinkEvent(array(
'project_id' => 1,
@@ -37,25 +37,24 @@ class TaskAssignCategoryLinkTest extends Base
$this->assertTrue($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
- $task = $tf->getById(1);
+ $task = $taskFinderModel->getById(1);
$this->assertEquals(1, $task['category_id']);
}
public function testWhenLinkDontMatch()
{
- $tc = new TaskCreationModel($this->container);
- $tf = new TaskFinderModel($this->container);
- $p = new ProjectModel($this->container);
- $c = new CategoryModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $categoryModel = new CategoryModel($this->container);
$action = new TaskAssignCategoryLink($this->container);
$action->setProjectId(1);
$action->setParam('category_id', 1);
$action->setParam('link_id', 1);
- $this->assertEquals(1, $p->create(array('name' => 'P1')));
- $this->assertEquals(1, $c->create(array('name' => 'C1', 'project_id' => 1)));
- $this->assertEquals(1, $tc->create(array('title' => 'T1', 'project_id' => 1)));
+ $this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
+ $this->assertEquals(1, $categoryModel->create(array('name' => 'C1', 'project_id' => 1)));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'T1', 'project_id' => 1)));
$event = new TaskLinkEvent(array(
'project_id' => 1,
@@ -69,19 +68,19 @@ class TaskAssignCategoryLinkTest extends Base
public function testThatExistingCategoryWillNotChange()
{
- $tc = new TaskCreationModel($this->container);
- $p = new ProjectModel($this->container);
- $c = new CategoryModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $categoryModel = new CategoryModel($this->container);
$action = new TaskAssignCategoryLink($this->container);
$action->setProjectId(1);
$action->setParam('category_id', 2);
$action->setParam('link_id', 2);
- $this->assertEquals(1, $p->create(array('name' => 'P1')));
- $this->assertEquals(1, $c->create(array('name' => 'C1', 'project_id' => 1)));
- $this->assertEquals(2, $c->create(array('name' => 'C2', 'project_id' => 1)));
- $this->assertEquals(1, $tc->create(array('title' => 'T1', 'project_id' => 1, 'category_id' => 1)));
+ $this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
+ $this->assertEquals(1, $categoryModel->create(array('name' => 'C1', 'project_id' => 1)));
+ $this->assertEquals(2, $categoryModel->create(array('name' => 'C2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'T1', 'project_id' => 1, 'category_id' => 1)));
$event = new TaskLinkEvent(array(
'project_id' => 1,
diff --git a/tests/units/Action/TaskAssignColorCategoryTest.php b/tests/units/Action/TaskAssignColorCategoryTest.php
index 6502035f..16ad1290 100644
--- a/tests/units/Action/TaskAssignColorCategoryTest.php
+++ b/tests/units/Action/TaskAssignColorCategoryTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\CategoryModel;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
@@ -23,7 +23,13 @@ class TaskAssignColorCategoryTest extends Base
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
$this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1)));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'category_id' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'category_id' => 1,
+ )
+ ));
$action = new TaskAssignColorCategory($this->container);
$action->setProjectId(1);
@@ -45,7 +51,13 @@ class TaskAssignColorCategoryTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'category_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'category_id' => 2,
+ )
+ ));
$action = new TaskAssignColorCategory($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskAssignColorColumnTest.php b/tests/units/Action/TaskAssignColorColumnTest.php
index d4ba8e01..ccfb9e88 100644
--- a/tests/units/Action/TaskAssignColorColumnTest.php
+++ b/tests/units/Action/TaskAssignColorColumnTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
@@ -20,7 +20,13 @@ class TaskAssignColorColumnTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ )
+ ));
$action = new TaskAssignColorColumn($this->container);
$action->setProjectId(1);
@@ -42,7 +48,13 @@ class TaskAssignColorColumnTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 3,
+ )
+ ));
$action = new TaskAssignColorColumn($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskAssignColorPriorityTest.php b/tests/units/Action/TaskAssignColorPriorityTest.php
index 2fce8e66..0ea874cd 100644
--- a/tests/units/Action/TaskAssignColorPriorityTest.php
+++ b/tests/units/Action/TaskAssignColorPriorityTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\CategoryModel;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
@@ -23,7 +23,13 @@ class TaskAssignColorPriorityTest extends Base
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
$this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1)));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'priority' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'priority' => 1,
+ )
+ ));
$action = new TaskAssignColorPriority($this->container);
$action->setProjectId(1);
@@ -45,7 +51,13 @@ class TaskAssignColorPriorityTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'priority' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'priority' => 2,
+ )
+ ));
$action = new TaskAssignColorPriority($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskAssignColorUserTest.php b/tests/units/Action/TaskAssignColorUserTest.php
index 370f9070..45faa3ff 100644
--- a/tests/units/Action/TaskAssignColorUserTest.php
+++ b/tests/units/Action/TaskAssignColorUserTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
@@ -20,7 +20,13 @@ class TaskAssignColorUserTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'owner_id' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'owner_id' => 1,
+ )
+ ));
$action = new TaskAssignColorUser($this->container);
$action->setProjectId(1);
@@ -42,7 +48,13 @@ class TaskAssignColorUserTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'owner_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'owner_id' => 2,
+ )
+ ));
$action = new TaskAssignColorUser($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskAssignCurrentUserColumnTest.php b/tests/units/Action/TaskAssignCurrentUserColumnTest.php
index 6fdbda63..3b64d718 100644
--- a/tests/units/Action/TaskAssignCurrentUserColumnTest.php
+++ b/tests/units/Action/TaskAssignCurrentUserColumnTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
@@ -22,7 +22,13 @@ class TaskAssignCurrentUserColumnTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ )
+ ));
$action = new TaskAssignCurrentUserColumn($this->container);
$action->setProjectId(1);
@@ -45,7 +51,13 @@ class TaskAssignCurrentUserColumnTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 3,
+ )
+ ));
$action = new TaskAssignCurrentUserColumn($this->container);
$action->setProjectId(1);
@@ -62,7 +74,13 @@ class TaskAssignCurrentUserColumnTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ )
+ ));
$action = new TaskAssignCurrentUserColumn($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskAssignSpecificUserTest.php b/tests/units/Action/TaskAssignSpecificUserTest.php
index 78ec314f..0e63fc13 100644
--- a/tests/units/Action/TaskAssignSpecificUserTest.php
+++ b/tests/units/Action/TaskAssignSpecificUserTest.php
@@ -3,6 +3,7 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
@@ -20,7 +21,13 @@ class TaskAssignSpecificUserTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => 0)));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ )
+ ));
$action = new TaskAssignSpecificUser($this->container);
$action->setProjectId(1);
@@ -42,7 +49,13 @@ class TaskAssignSpecificUserTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 3,
+ )
+ ));
$action = new TaskAssignSpecificUser($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskCloseColumnTest.php b/tests/units/Action/TaskCloseColumnTest.php
index f9a938f0..7afb0478 100644
--- a/tests/units/Action/TaskCloseColumnTest.php
+++ b/tests/units/Action/TaskCloseColumnTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
@@ -20,7 +20,13 @@ class TaskCloseColumnTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ )
+ ));
$action = new TaskCloseColumn($this->container);
$action->setProjectId(1);
@@ -41,7 +47,13 @@ class TaskCloseColumnTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 3,
+ )
+ ));
$action = new TaskCloseColumn($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskCloseTest.php b/tests/units/Action/TaskCloseTest.php
index 3df10cb8..589ef133 100644
--- a/tests/units/Action/TaskCloseTest.php
+++ b/tests/units/Action/TaskCloseTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
@@ -19,7 +19,12 @@ class TaskCloseTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ )
+ ));
$action = new TaskClose($this->container);
$action->setProjectId(1);
@@ -40,7 +45,11 @@ class TaskCloseTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1));
+ $event = new TaskEvent(array(
+ 'task' => array(
+ 'project_id' => 1,
+ )
+ ));
$action = new TaskClose($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskDuplicateAnotherProjectTest.php b/tests/units/Action/TaskDuplicateAnotherProjectTest.php
index 98ff187f..5cd0c977 100644
--- a/tests/units/Action/TaskDuplicateAnotherProjectTest.php
+++ b/tests/units/Action/TaskDuplicateAnotherProjectTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\TaskCreationModel;
@@ -21,7 +21,13 @@ class TaskDuplicateAnotherProjectTest extends Base
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ )
+ ));
$action = new TaskDuplicateAnotherProject($this->container);
$action->setProjectId(1);
@@ -43,7 +49,13 @@ class TaskDuplicateAnotherProjectTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 3,
+ )
+ ));
$action = new TaskDuplicateAnotherProject($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskEmailTest.php b/tests/units/Action/TaskEmailTest.php
index df71aaf8..421c89ca 100644
--- a/tests/units/Action/TaskEmailTest.php
+++ b/tests/units/Action/TaskEmailTest.php
@@ -2,7 +2,8 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
+use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\TaskModel;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\ProjectModel;
@@ -16,16 +17,20 @@ class TaskEmailTest extends Base
$userModel = new UserModel($this->container);
$projectModel = new ProjectModel($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
$this->assertTrue($userModel->update(array('id' => 1, 'email' => 'admin@localhost')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => $taskFinderModel->getDetails(1)
+ ));
$action = new TaskEmail($this->container);
$action->setProjectId(1);
- $action->setParam('column_id', 2);
+ $action->setParam('column_id', 1);
$action->setParam('user_id', 1);
$action->setParam('subject', 'My email subject');
@@ -47,7 +52,13 @@ class TaskEmailTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 3,
+ )
+ ));
$action = new TaskEmail($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskMoveAnotherProjectTest.php b/tests/units/Action/TaskMoveAnotherProjectTest.php
index d36df47b..a41fd03f 100644
--- a/tests/units/Action/TaskMoveAnotherProjectTest.php
+++ b/tests/units/Action/TaskMoveAnotherProjectTest.php
@@ -3,6 +3,7 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\TaskCreationModel;
@@ -21,7 +22,13 @@ class TaskMoveAnotherProjectTest extends Base
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ )
+ ));
$action = new TaskMoveAnotherProject($this->container);
$action->setProjectId(1);
@@ -44,7 +51,13 @@ class TaskMoveAnotherProjectTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 3,
+ )
+ ));
$action = new TaskMoveAnotherProject($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskMoveColumnAssignedTest.php b/tests/units/Action/TaskMoveColumnAssignedTest.php
index f8982969..aa9d3592 100644
--- a/tests/units/Action/TaskMoveColumnAssignedTest.php
+++ b/tests/units/Action/TaskMoveColumnAssignedTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\TaskCreationModel;
@@ -19,9 +19,12 @@ class TaskMoveColumnAssignedTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
- $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'owner_id' => 1)));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 1, 'owner_id' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => $taskFinderModel->getDetails(1),
+ ));
$action = new TaskMoveColumnAssigned($this->container);
$action->setProjectId(1);
@@ -43,7 +46,14 @@ class TaskMoveColumnAssignedTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3, 'owner_id' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 3,
+ 'owner_id' => 1,
+ )
+ ));
$action = new TaskMoveColumnAssigned($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskMoveColumnCategoryChangeTest.php b/tests/units/Action/TaskMoveColumnCategoryChangeTest.php
index c42383f8..7e0856df 100644
--- a/tests/units/Action/TaskMoveColumnCategoryChangeTest.php
+++ b/tests/units/Action/TaskMoveColumnCategoryChangeTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\CategoryModel;
use Kanboard\Model\TaskModel;
use Kanboard\Model\TaskFinderModel;
@@ -24,7 +24,16 @@ class TaskMoveColumnCategoryChangeTest extends Base
$this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1)));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 1, 'category_id' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 1,
+ 'category_id' => 1,
+ 'position' => 1,
+ 'swimlane_id' => 0,
+ )
+ ));
$action = new TaskMoveColumnCategoryChange($this->container);
$action->setProjectId(1);
@@ -50,7 +59,14 @@ class TaskMoveColumnCategoryChangeTest extends Base
$this->assertEquals(1, $categoryModel->create(array('name' => 'c1', 'project_id' => 1)));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2, 'category_id' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ 'category_id' => 1,
+ )
+ ));
$action = new TaskMoveColumnCategoryChange($this->container);
$action->setProjectId(1);
@@ -72,7 +88,14 @@ class TaskMoveColumnCategoryChangeTest extends Base
$this->assertEquals(2, $categoryModel->create(array('name' => 'c2', 'project_id' => 1)));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 1, 'category_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 1,
+ 'category_id' => 2,
+ )
+ ));
$action = new TaskMoveColumnCategoryChange($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskMoveColumnUnAssignedTest.php b/tests/units/Action/TaskMoveColumnUnAssignedTest.php
index befae36b..b45dec08 100644
--- a/tests/units/Action/TaskMoveColumnUnAssignedTest.php
+++ b/tests/units/Action/TaskMoveColumnUnAssignedTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\TaskCreationModel;
@@ -21,7 +21,16 @@ class TaskMoveColumnUnAssignedTest extends Base
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 1, 'owner_id' => 0));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 1,
+ 'owner_id' => 0,
+ 'position' => 1,
+ 'swimlane_id' => 0,
+ )
+ ));
$action = new TaskMoveColumnUnAssigned($this->container);
$action->setProjectId(1);
@@ -43,7 +52,14 @@ class TaskMoveColumnUnAssignedTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2, 'owner_id' => 0));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ 'owner_id' => 0,
+ )
+ ));
$action = new TaskMoveColumnUnAssigned($this->container);
$action->setProjectId(1);
@@ -60,7 +76,14 @@ class TaskMoveColumnUnAssignedTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 1, 'owner_id' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 1,
+ 'owner_id' => 1,
+ )
+ ));
$action = new TaskMoveColumnUnAssigned($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskOpenTest.php b/tests/units/Action/TaskOpenTest.php
index 1018e2ea..825c6ac9 100644
--- a/tests/units/Action/TaskOpenTest.php
+++ b/tests/units/Action/TaskOpenTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
@@ -19,7 +19,12 @@ class TaskOpenTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'is_active' => 0)));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ )
+ ));
$action = new TaskOpen($this->container);
$action->setProjectId(1);
@@ -40,7 +45,11 @@ class TaskOpenTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1));
+ $event = new TaskEvent(array(
+ 'task' => array(
+ 'project_id' => 1,
+ )
+ ));
$action = new TaskOpen($this->container);
$action->setProjectId(1);
diff --git a/tests/units/Action/TaskUpdateStartDateTest.php b/tests/units/Action/TaskUpdateStartDateTest.php
index ddd9eafd..8d609b3e 100644
--- a/tests/units/Action/TaskUpdateStartDateTest.php
+++ b/tests/units/Action/TaskUpdateStartDateTest.php
@@ -3,6 +3,7 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Event\GenericEvent;
+use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
@@ -20,7 +21,13 @@ class TaskUpdateStartDateTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 2,
+ )
+ ));
$action = new TaskUpdateStartDate($this->container);
$action->setProjectId(1);
@@ -41,7 +48,13 @@ class TaskUpdateStartDateTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 3));
+ $event = new TaskEvent(array(
+ 'task_id' => 1,
+ 'task' => array(
+ 'project_id' => 1,
+ 'column_id' => 3,
+ )
+ ));
$action = new TaskUpdateStartDate($this->container);
$action->setProjectId(1);
--
cgit v1.2.3
From b6119e7dee84869a619dedccd9c80df4422a4f5b Mon Sep 17 00:00:00 2001
From: Frederic Guillot
Date: Sat, 23 Jul 2016 14:05:15 -0400
Subject: Added internal task links to activity stream
---
ChangeLog | 1 +
app/Action/TaskAssignCategoryLink.php | 13 +-
app/Action/TaskAssignColorLink.php | 10 +-
app/Core/Base.php | 1 +
app/EventBuilder/TaskLinkEventBuilder.php | 89 +++++++++++
app/Helper/HookHelper.php | 2 +-
app/Job/TaskLinkEventJob.php | 45 ++++++
app/Model/NotificationModel.php | 39 ++---
app/Model/TaskLinkModel.php | 173 ++++++++++++---------
app/ServiceProvider/JobProvider.php | 5 +
app/Subscriber/NotificationSubscriber.php | 3 +
.../event/task_internal_link_create_update.php | 16 ++
app/Template/event/task_internal_link_delete.php | 16 ++
app/Template/notification/task_file_create.php | 2 +-
.../task_internal_link_create_update.php | 11 ++
.../notification/task_internal_link_delete.php | 11 ++
tests/units/Action/TaskAssignCategoryLinkTest.php | 51 +++---
tests/units/Action/TaskAssignColorLinkTest.php | 45 ++++--
.../EventBuilder/TaskLinkEventBuilderTest.php | 70 +++++++++
tests/units/Job/TaskLinkEventJobTest.php | 65 ++++++++
tests/units/Model/NotificationModelTest.php | 39 ++---
tests/units/Model/TaskLinkModelTest.php | 28 ++++
tests/units/Notification/MailNotificationTest.php | 117 ++++++++++++++
tests/units/Notification/MailTest.php | 117 --------------
.../units/Notification/WebhookNotificationTest.php | 29 ++++
tests/units/Notification/WebhookTest.php | 29 ----
26 files changed, 705 insertions(+), 322 deletions(-)
create mode 100644 app/EventBuilder/TaskLinkEventBuilder.php
create mode 100644 app/Job/TaskLinkEventJob.php
create mode 100644 app/Template/event/task_internal_link_create_update.php
create mode 100644 app/Template/event/task_internal_link_delete.php
create mode 100644 app/Template/notification/task_internal_link_create_update.php
create mode 100644 app/Template/notification/task_internal_link_delete.php
create mode 100644 tests/units/EventBuilder/TaskLinkEventBuilderTest.php
create mode 100644 tests/units/Job/TaskLinkEventJobTest.php
create mode 100644 tests/units/Notification/MailNotificationTest.php
delete mode 100644 tests/units/Notification/MailTest.php
create mode 100644 tests/units/Notification/WebhookNotificationTest.php
delete mode 100644 tests/units/Notification/WebhookTest.php
(limited to 'tests/units/Action')
diff --git a/ChangeLog b/ChangeLog
index a1e39436..ee57c86c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ Version 1.0.32 (unreleased)
New features:
* New automated action to close tasks without activity in a specific column
+* Added internal task links to activity stream
* Added new event for removed comments
* Added search filter for task priority
* Added the possibility to hide tasks in dashboard for a specific column
diff --git a/app/Action/TaskAssignCategoryLink.php b/app/Action/TaskAssignCategoryLink.php
index 6937edd1..d4a4c0ec 100644
--- a/app/Action/TaskAssignCategoryLink.php
+++ b/app/Action/TaskAssignCategoryLink.php
@@ -60,8 +60,10 @@ class TaskAssignCategoryLink extends Base
public function getEventRequiredParameters()
{
return array(
- 'task_id',
- 'link_id',
+ 'task_link' => array(
+ 'task_id',
+ 'link_id',
+ )
);
}
@@ -75,7 +77,7 @@ class TaskAssignCategoryLink extends Base
public function doAction(array $data)
{
$values = array(
- 'id' => $data['task_id'],
+ 'id' => $data['task_link']['task_id'],
'category_id' => $this->getParam('category_id'),
);
@@ -91,9 +93,8 @@ class TaskAssignCategoryLink extends Base
*/
public function hasRequiredCondition(array $data)
{
- if ($data['link_id'] == $this->getParam('link_id')) {
- $task = $this->taskFinderModel->getById($data['task_id']);
- return empty($task['category_id']);
+ if ($data['task_link']['link_id'] == $this->getParam('link_id')) {
+ return empty($data['task']['category_id']);
}
return false;
diff --git a/app/Action/TaskAssignColorLink.php b/app/Action/TaskAssignColorLink.php
index 9ab5458b..9759f622 100644
--- a/app/Action/TaskAssignColorLink.php
+++ b/app/Action/TaskAssignColorLink.php
@@ -59,8 +59,10 @@ class TaskAssignColorLink extends Base
public function getEventRequiredParameters()
{
return array(
- 'task_id',
- 'link_id',
+ 'task_link' => array(
+ 'task_id',
+ 'link_id',
+ )
);
}
@@ -74,7 +76,7 @@ class TaskAssignColorLink extends Base
public function doAction(array $data)
{
$values = array(
- 'id' => $data['task_id'],
+ 'id' => $data['task_link']['task_id'],
'color_id' => $this->getParam('color_id'),
);
@@ -90,6 +92,6 @@ class TaskAssignColorLink extends Base
*/
public function hasRequiredCondition(array $data)
{
- return $data['link_id'] == $this->getParam('link_id');
+ return $data['task_link']['link_id'] == $this->getParam('link_id');
}
}
diff --git a/app/Core/Base.php b/app/Core/Base.php
index 098bd880..20a2d391 100644
--- a/app/Core/Base.php
+++ b/app/Core/Base.php
@@ -154,6 +154,7 @@ use Pimple\Container;
* @property \Kanboard\Job\SubtaskEventJob $subtaskEventJob
* @property \Kanboard\Job\TaskEventJob $taskEventJob
* @property \Kanboard\Job\TaskFileEventJob $taskFileEventJob
+ * @property \Kanboard\Job\TaskLinkEventJob $taskLinkEventJob
* @property \Kanboard\Job\ProjectFileEventJob $projectFileEventJob
* @property \Kanboard\Job\NotificationJob $notificationJob
* @property \Psr\Log\LoggerInterface $logger
diff --git a/app/EventBuilder/TaskLinkEventBuilder.php b/app/EventBuilder/TaskLinkEventBuilder.php
new file mode 100644
index 00000000..8be5299f
--- /dev/null
+++ b/app/EventBuilder/TaskLinkEventBuilder.php
@@ -0,0 +1,89 @@
+taskLinkId = $taskLinkId;
+ return $this;
+ }
+
+ /**
+ * Build event data
+ *
+ * @access public
+ * @return TaskLinkEvent|null
+ */
+ public function build()
+ {
+ $taskLink = $this->taskLinkModel->getById($this->taskLinkId);
+
+ if (empty($taskLink)) {
+ $this->logger->debug(__METHOD__.': TaskLink not found');
+ return null;
+ }
+
+ return new TaskLinkEvent(array(
+ 'task_link' => $taskLink,
+ 'task' => $this->taskFinderModel->getDetails($taskLink['task_id']),
+ ));
+ }
+
+ /**
+ * Get event title with author
+ *
+ * @access public
+ * @param string $author
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithAuthor($author, $eventName, array $eventData)
+ {
+ if ($eventName === TaskLinkModel::EVENT_CREATE_UPDATE) {
+ return e('%s set a new internal link for the task #%d', $author, $eventData['task']['id']);
+ } elseif ($eventName === TaskLinkModel::EVENT_DELETE) {
+ return e('%s removed an internal link for the task #%d', $author, $eventData['task']['id']);
+ }
+
+ return '';
+ }
+
+ /**
+ * Get event title without author
+ *
+ * @access public
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithoutAuthor($eventName, array $eventData)
+ {
+ if ($eventName === TaskLinkModel::EVENT_CREATE_UPDATE) {
+ return e('A new internal link for the task #%d have been defined', $eventData['task']['id']);
+ } elseif ($eventName === TaskLinkModel::EVENT_DELETE) {
+ return e('Internal link removed for the task #%d', $eventData['task']['id']);
+ }
+
+ return '';
+ }
+}
diff --git a/app/Helper/HookHelper.php b/app/Helper/HookHelper.php
index 2d13ebcc..cb4dc1ef 100644
--- a/app/Helper/HookHelper.php
+++ b/app/Helper/HookHelper.php
@@ -56,7 +56,7 @@ class HookHelper extends Base
* @access public
* @param string $hook
* @param string $template
- * @return \Kanboard\Helper\Hook
+ * @return $this
*/
public function attach($hook, $template)
{
diff --git a/app/Job/TaskLinkEventJob.php b/app/Job/TaskLinkEventJob.php
new file mode 100644
index 00000000..669608ad
--- /dev/null
+++ b/app/Job/TaskLinkEventJob.php
@@ -0,0 +1,45 @@
+jobParams = array($taskLinkId, $eventName);
+ return $this;
+ }
+
+ /**
+ * Execute job
+ *
+ * @param int $taskLinkId
+ * @param string $eventName
+ * @return $this
+ */
+ public function execute($taskLinkId, $eventName)
+ {
+ $event = TaskLinkEventBuilder::getInstance($this->container)
+ ->withTaskLinkId($taskLinkId)
+ ->build();
+
+ if ($event !== null) {
+ $this->dispatcher->dispatch($eventName, $event);
+ }
+ }
+}
diff --git a/app/Model/NotificationModel.php b/app/Model/NotificationModel.php
index 925d646e..39c1f581 100644
--- a/app/Model/NotificationModel.php
+++ b/app/Model/NotificationModel.php
@@ -3,6 +3,7 @@
namespace Kanboard\Model;
use Kanboard\Core\Base;
+use Kanboard\EventBuilder\TaskLinkEventBuilder;
/**
* Notification
@@ -85,7 +86,9 @@ class NotificationModel extends Base
case CommentModel::EVENT_USER_MENTION:
return e('%s mentioned you in a comment on the task #%d', $event_author, $event_data['task']['id']);
default:
- return e('Notification');
+ return TaskLinkEventBuilder::getInstance($this->container)
+ ->buildTitleWithAuthor($event_author, $event_name, $event_data) ?:
+ e('Notification');
}
}
@@ -138,7 +141,9 @@ class NotificationModel extends Base
case CommentModel::EVENT_USER_MENTION:
return e('You were mentioned in a comment on the task #%d', $event_data['task']['id']);
default:
- return e('Notification');
+ return TaskLinkEventBuilder::getInstance($this->container)
+ ->buildTitleWithoutAuthor($event_name, $event_data) ?:
+ e('Notification');
}
}
@@ -152,32 +157,10 @@ class NotificationModel extends Base
*/
public function getTaskIdFromEvent($event_name, array $event_data)
{
- switch ($event_name) {
- case TaskFileModel::EVENT_CREATE:
- return $event_data['file']['task_id'];
- case CommentModel::EVENT_CREATE:
- case CommentModel::EVENT_UPDATE:
- case CommentModel::EVENT_DELETE:
- return $event_data['comment']['task_id'];
- case SubtaskModel::EVENT_CREATE:
- case SubtaskModel::EVENT_UPDATE:
- case SubtaskModel::EVENT_DELETE:
- return $event_data['subtask']['task_id'];
- case TaskModel::EVENT_CREATE:
- case TaskModel::EVENT_UPDATE:
- case TaskModel::EVENT_CLOSE:
- case TaskModel::EVENT_OPEN:
- case TaskModel::EVENT_MOVE_COLUMN:
- case TaskModel::EVENT_MOVE_POSITION:
- case TaskModel::EVENT_MOVE_SWIMLANE:
- case TaskModel::EVENT_ASSIGNEE_CHANGE:
- case CommentModel::EVENT_USER_MENTION:
- case TaskModel::EVENT_USER_MENTION:
- return $event_data['task']['id'];
- case TaskModel::EVENT_OVERDUE:
- return $event_data['tasks'][0]['id'];
- default:
- return 0;
+ if ($event_name === TaskModel::EVENT_OVERDUE) {
+ return $event_data['tasks'][0]['id'];
}
+
+ return isset($event_data['task']['id']) ? $event_data['task']['id'] : 0;
}
}
diff --git a/app/Model/TaskLinkModel.php b/app/Model/TaskLinkModel.php
index 09978eae..e8d3c5df 100644
--- a/app/Model/TaskLinkModel.php
+++ b/app/Model/TaskLinkModel.php
@@ -3,7 +3,6 @@
namespace Kanboard\Model;
use Kanboard\Core\Base;
-use Kanboard\Event\TaskLinkEvent;
/**
* TaskLink model
@@ -26,7 +25,8 @@ class TaskLinkModel extends Base
*
* @var string
*/
- const EVENT_CREATE_UPDATE = 'tasklink.create_update';
+ const EVENT_CREATE_UPDATE = 'task_internal_link.create_update';
+ const EVENT_DELETE = 'task_internal_link.delete';
/**
* Get projectId from $task_link_id
@@ -53,7 +53,19 @@ class TaskLinkModel extends Base
*/
public function getById($task_link_id)
{
- return $this->db->table(self::TABLE)->eq('id', $task_link_id)->findOne();
+ return $this->db
+ ->table(self::TABLE)
+ ->columns(
+ self::TABLE.'.id',
+ self::TABLE.'.opposite_task_id',
+ self::TABLE.'.task_id',
+ self::TABLE.'.link_id',
+ LinkModel::TABLE.'.label',
+ LinkModel::TABLE.'.opposite_id AS opposite_link_id'
+ )
+ ->eq(self::TABLE.'.id', $task_link_id)
+ ->join(LinkModel::TABLE, 'id', 'link_id')
+ ->findOne();
}
/**
@@ -139,20 +151,6 @@ class TaskLinkModel extends Base
return $result;
}
- /**
- * Publish events
- *
- * @access private
- * @param array $events
- */
- private function fireEvents(array $events)
- {
- foreach ($events as $event) {
- $event['project_id'] = $this->taskFinderModel->getProjectId($event['task_id']);
- $this->container['dispatcher']->dispatch(self::EVENT_CREATE_UPDATE, new TaskLinkEvent($event));
- }
- }
-
/**
* Create a new link
*
@@ -160,42 +158,25 @@ class TaskLinkModel extends Base
* @param integer $task_id Task id
* @param integer $opposite_task_id Opposite task id
* @param integer $link_id Link id
- * @return integer Task link id
+ * @return integer|boolean
*/
public function create($task_id, $opposite_task_id, $link_id)
{
- $events = array();
$this->db->startTransaction();
- // Get opposite link
$opposite_link_id = $this->linkModel->getOppositeLinkId($link_id);
+ $task_link_id1 = $this->createTaskLink($task_id, $opposite_task_id, $link_id);
+ $task_link_id2 = $this->createTaskLink($opposite_task_id, $task_id, $opposite_link_id);
- $values = array(
- 'task_id' => $task_id,
- 'opposite_task_id' => $opposite_task_id,
- 'link_id' => $link_id,
- );
-
- // Create the original task link
- $this->db->table(self::TABLE)->insert($values);
- $task_link_id = $this->db->getLastId();
- $events[] = $values;
-
- // Create the opposite task link
- $values = array(
- 'task_id' => $opposite_task_id,
- 'opposite_task_id' => $task_id,
- 'link_id' => $opposite_link_id,
- );
-
- $this->db->table(self::TABLE)->insert($values);
- $events[] = $values;
+ if ($task_link_id1 === false || $task_link_id2 === false) {
+ $this->db->cancelTransaction();
+ return false;
+ }
$this->db->closeTransaction();
+ $this->fireEvents(array($task_link_id1, $task_link_id2), self::EVENT_CREATE_UPDATE);
- $this->fireEvents($events);
-
- return (int) $task_link_id;
+ return $task_link_id1;
}
/**
@@ -210,46 +191,24 @@ class TaskLinkModel extends Base
*/
public function update($task_link_id, $task_id, $opposite_task_id, $link_id)
{
- $events = array();
$this->db->startTransaction();
- // Get original task link
$task_link = $this->getById($task_link_id);
-
- // Find opposite task link
$opposite_task_link = $this->getOppositeTaskLink($task_link);
-
- // Get opposite link
$opposite_link_id = $this->linkModel->getOppositeLinkId($link_id);
- // Update the original task link
- $values = array(
- 'task_id' => $task_id,
- 'opposite_task_id' => $opposite_task_id,
- 'link_id' => $link_id,
- );
-
- $rs1 = $this->db->table(self::TABLE)->eq('id', $task_link_id)->update($values);
- $events[] = $values;
+ $result1 = $this->updateTaskLink($task_link_id, $task_id, $opposite_task_id, $link_id);
+ $result2 = $this->updateTaskLink($opposite_task_link['id'], $opposite_task_id, $task_id, $opposite_link_id);
- // Update the opposite link
- $values = array(
- 'task_id' => $opposite_task_id,
- 'opposite_task_id' => $task_id,
- 'link_id' => $opposite_link_id,
- );
-
- $rs2 = $this->db->table(self::TABLE)->eq('id', $opposite_task_link['id'])->update($values);
- $events[] = $values;
+ if ($result1 === false || $result2 === false) {
+ $this->db->cancelTransaction();
+ return false;
+ }
$this->db->closeTransaction();
+ $this->fireEvents(array($task_link_id, $opposite_task_link['id']), self::EVENT_CREATE_UPDATE);
- if ($rs1 && $rs2) {
- $this->fireEvents($events);
- return true;
- }
-
- return false;
+ return true;
}
/**
@@ -261,21 +220,83 @@ class TaskLinkModel extends Base
*/
public function remove($task_link_id)
{
+ $this->taskLinkEventJob->execute($task_link_id, self::EVENT_DELETE);
+
$this->db->startTransaction();
$link = $this->getById($task_link_id);
$link_id = $this->linkModel->getOppositeLinkId($link['link_id']);
- $this->db->table(self::TABLE)->eq('id', $task_link_id)->remove();
+ $result1 = $this->db
+ ->table(self::TABLE)
+ ->eq('id', $task_link_id)
+ ->remove();
- $this->db
+ $result2 = $this->db
->table(self::TABLE)
->eq('opposite_task_id', $link['task_id'])
->eq('task_id', $link['opposite_task_id'])
- ->eq('link_id', $link_id)->remove();
+ ->eq('link_id', $link_id)
+ ->remove();
+
+ if ($result1 === false || $result2 === false) {
+ $this->db->cancelTransaction();
+ return false;
+ }
$this->db->closeTransaction();
return true;
}
+
+ /**
+ * Publish events
+ *
+ * @access protected
+ * @param integer[] $task_link_ids
+ * @param string $eventName
+ */
+ protected function fireEvents(array $task_link_ids, $eventName)
+ {
+ foreach ($task_link_ids as $task_link_id) {
+ $this->queueManager->push($this->taskLinkEventJob->withParams($task_link_id, $eventName));
+ }
+ }
+
+ /**
+ * Create task link
+ *
+ * @access protected
+ * @param integer $task_id
+ * @param integer $opposite_task_id
+ * @param integer $link_id
+ * @return integer|boolean
+ */
+ protected function createTaskLink($task_id, $opposite_task_id, $link_id)
+ {
+ return $this->db->table(self::TABLE)->persist(array(
+ 'task_id' => $task_id,
+ 'opposite_task_id' => $opposite_task_id,
+ 'link_id' => $link_id,
+ ));
+ }
+
+ /**
+ * Update task link
+ *
+ * @access protected
+ * @param integer $task_link_id
+ * @param integer $task_id
+ * @param integer $opposite_task_id
+ * @param integer $link_id
+ * @return boolean
+ */
+ protected function updateTaskLink($task_link_id, $task_id, $opposite_task_id, $link_id)
+ {
+ return $this->db->table(self::TABLE)->eq('id', $task_link_id)->update(array(
+ 'task_id' => $task_id,
+ 'opposite_task_id' => $opposite_task_id,
+ 'link_id' => $link_id,
+ ));
+ }
}
diff --git a/app/ServiceProvider/JobProvider.php b/app/ServiceProvider/JobProvider.php
index c7f323f1..5b42794b 100644
--- a/app/ServiceProvider/JobProvider.php
+++ b/app/ServiceProvider/JobProvider.php
@@ -8,6 +8,7 @@ use Kanboard\Job\ProjectFileEventJob;
use Kanboard\Job\SubtaskEventJob;
use Kanboard\Job\TaskEventJob;
use Kanboard\Job\TaskFileEventJob;
+use Kanboard\Job\TaskLinkEventJob;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
@@ -44,6 +45,10 @@ class JobProvider implements ServiceProviderInterface
return new TaskFileEventJob($c);
});
+ $container['taskLinkEventJob'] = $container->factory(function ($c) {
+ return new TaskLinkEventJob($c);
+ });
+
$container['projectFileEventJob'] = $container->factory(function ($c) {
return new ProjectFileEventJob($c);
});
diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php
index 7de24e49..7cc68b26 100644
--- a/app/Subscriber/NotificationSubscriber.php
+++ b/app/Subscriber/NotificationSubscriber.php
@@ -3,6 +3,7 @@
namespace Kanboard\Subscriber;
use Kanboard\Event\GenericEvent;
+use Kanboard\Model\TaskLinkModel;
use Kanboard\Model\TaskModel;
use Kanboard\Model\CommentModel;
use Kanboard\Model\SubtaskModel;
@@ -31,6 +32,8 @@ class NotificationSubscriber extends BaseSubscriber implements EventSubscriberIn
CommentModel::EVENT_DELETE => 'handleEvent',
CommentModel::EVENT_USER_MENTION => 'handleEvent',
TaskFileModel::EVENT_CREATE => 'handleEvent',
+ TaskLinkModel::EVENT_CREATE_UPDATE => 'handleEvent',
+ TaskLinkModel::EVENT_DELETE => 'handleEvent',
);
}
diff --git a/app/Template/event/task_internal_link_create_update.php b/app/Template/event/task_internal_link_create_update.php
new file mode 100644
index 00000000..de257977
--- /dev/null
+++ b/app/Template/event/task_internal_link_create_update.php
@@ -0,0 +1,16 @@
+
+ = e('%s set a new internal link for the task %s',
+ $this->text->e($author),
+ $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))
+ ) ?>
+ = $this->dt->datetime($date_creation) ?>
+
+
+
+ = e(
+ 'This task is now linked to the task %s with the relation "%s"',
+ $this->url->link(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id'])),
+ $this->text->e($task_link['label'])
+ ) ?>
+
+
diff --git a/app/Template/event/task_internal_link_delete.php b/app/Template/event/task_internal_link_delete.php
new file mode 100644
index 00000000..e537bf81
--- /dev/null
+++ b/app/Template/event/task_internal_link_delete.php
@@ -0,0 +1,16 @@
+
+ = e('%s removed an internal link for the task %s',
+ $this->text->e($author),
+ $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))
+ ) ?>
+ = $this->dt->datetime($date_creation) ?>
+
+
+
+ = e(
+ 'The link with the relation "%s" to the task %s have been removed',
+ $this->text->e($task_link['label']),
+ $this->url->link(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id']))
+ ) ?>
+
+
diff --git a/app/Template/notification/task_file_create.php b/app/Template/notification/task_file_create.php
index feab8dd2..c19f7279 100644
--- a/app/Template/notification/task_file_create.php
+++ b/app/Template/notification/task_file_create.php
@@ -2,4 +2,4 @@
= t('New attachment added "%s"', $file['name']) ?>
-= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
\ No newline at end of file
+= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
diff --git a/app/Template/notification/task_internal_link_create_update.php b/app/Template/notification/task_internal_link_create_update.php
new file mode 100644
index 00000000..73cad84d
--- /dev/null
+++ b/app/Template/notification/task_internal_link_create_update.php
@@ -0,0 +1,11 @@
+= $this->text->e($task['title']) ?> (#= $task['id'] ?>)
+
+
+ = e(
+ 'This task is now linked to the task %s with the relation "%s"',
+ $this->url->link(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id'])),
+ $this->text->e($task_link['label'])
+ ) ?>
+
+
+= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
diff --git a/app/Template/notification/task_internal_link_delete.php b/app/Template/notification/task_internal_link_delete.php
new file mode 100644
index 00000000..bb54e0a7
--- /dev/null
+++ b/app/Template/notification/task_internal_link_delete.php
@@ -0,0 +1,11 @@
+= $this->text->e($task['title']) ?> (#= $task['id'] ?>)
+
+
+ = e(
+ 'The link with the relation "%s" to the task %s have been removed',
+ $this->text->e($task_link['label']),
+ $this->url->link(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id']))
+ ) ?>
+
+
+= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
diff --git a/tests/units/Action/TaskAssignCategoryLinkTest.php b/tests/units/Action/TaskAssignCategoryLinkTest.php
index d7e68f72..b9d7e9d9 100644
--- a/tests/units/Action/TaskAssignCategoryLinkTest.php
+++ b/tests/units/Action/TaskAssignCategoryLinkTest.php
@@ -2,12 +2,12 @@
require_once __DIR__.'/../Base.php';
+use Kanboard\EventBuilder\TaskLinkEventBuilder;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\TaskLinkModel;
use Kanboard\Model\CategoryModel;
-use Kanboard\Event\TaskLinkEvent;
use Kanboard\Action\TaskAssignCategoryLink;
class TaskAssignCategoryLinkTest extends Base
@@ -18,6 +18,7 @@ class TaskAssignCategoryLinkTest extends Base
$taskFinderModel = new TaskFinderModel($this->container);
$projectModel = new ProjectModel($this->container);
$categoryModel = new CategoryModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
$action = new TaskAssignCategoryLink($this->container);
$action->setProjectId(1);
@@ -27,13 +28,12 @@ class TaskAssignCategoryLinkTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
$this->assertEquals(1, $categoryModel->create(array('name' => 'C1', 'project_id' => 1)));
$this->assertEquals(1, $taskCreationModel->create(array('title' => 'T1', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'T2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 2));
- $event = new TaskLinkEvent(array(
- 'project_id' => 1,
- 'task_id' => 1,
- 'opposite_task_id' => 2,
- 'link_id' => 2,
- ));
+ $event = TaskLinkEventBuilder::getInstance($this->container)
+ ->withTaskLinkId(1)
+ ->build();
$this->assertTrue($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
@@ -44,51 +44,58 @@ class TaskAssignCategoryLinkTest extends Base
public function testWhenLinkDontMatch()
{
$taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
$projectModel = new ProjectModel($this->container);
$categoryModel = new CategoryModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
$action = new TaskAssignCategoryLink($this->container);
$action->setProjectId(1);
$action->setParam('category_id', 1);
- $action->setParam('link_id', 1);
+ $action->setParam('link_id', 2);
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
$this->assertEquals(1, $categoryModel->create(array('name' => 'C1', 'project_id' => 1)));
$this->assertEquals(1, $taskCreationModel->create(array('title' => 'T1', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'T2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
- $event = new TaskLinkEvent(array(
- 'project_id' => 1,
- 'task_id' => 1,
- 'opposite_task_id' => 2,
- 'link_id' => 2,
- ));
+ $event = TaskLinkEventBuilder::getInstance($this->container)
+ ->withTaskLinkId(1)
+ ->build();
$this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertEquals(0, $task['category_id']);
}
public function testThatExistingCategoryWillNotChange()
{
$taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
$projectModel = new ProjectModel($this->container);
$categoryModel = new CategoryModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
$action = new TaskAssignCategoryLink($this->container);
$action->setProjectId(1);
- $action->setParam('category_id', 2);
+ $action->setParam('category_id', 1);
$action->setParam('link_id', 2);
$this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
$this->assertEquals(1, $categoryModel->create(array('name' => 'C1', 'project_id' => 1)));
- $this->assertEquals(2, $categoryModel->create(array('name' => 'C2', 'project_id' => 1)));
$this->assertEquals(1, $taskCreationModel->create(array('title' => 'T1', 'project_id' => 1, 'category_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'T2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 2));
- $event = new TaskLinkEvent(array(
- 'project_id' => 1,
- 'task_id' => 1,
- 'opposite_task_id' => 2,
- 'link_id' => 2,
- ));
+ $event = TaskLinkEventBuilder::getInstance($this->container)
+ ->withTaskLinkId(1)
+ ->build();
$this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertEquals(1, $task['category_id']);
}
}
diff --git a/tests/units/Action/TaskAssignColorLinkTest.php b/tests/units/Action/TaskAssignColorLinkTest.php
index 07d0969b..27364bc9 100644
--- a/tests/units/Action/TaskAssignColorLinkTest.php
+++ b/tests/units/Action/TaskAssignColorLinkTest.php
@@ -2,7 +2,7 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
+use Kanboard\EventBuilder\TaskLinkEventBuilder;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
use Kanboard\Model\ProjectModel;
@@ -13,42 +13,55 @@ class TaskAssignColorLinkTest extends Base
{
public function testChangeColor()
{
- $projectModel = new ProjectModel($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
$taskFinderModel = new TaskFinderModel($this->container);
-
- $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
- $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
-
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'link_id' => 1));
+ $projectModel = new ProjectModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
$action = new TaskAssignColorLink($this->container);
$action->setProjectId(1);
+ $action->setParam('link_id', 2);
$action->setParam('color_id', 'red');
- $action->setParam('link_id', 1);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'T1', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'T2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 2));
+
+ $event = TaskLinkEventBuilder::getInstance($this->container)
+ ->withTaskLinkId(1)
+ ->build();
$this->assertTrue($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
$task = $taskFinderModel->getById(1);
- $this->assertNotEmpty($task);
$this->assertEquals('red', $task['color_id']);
}
public function testWithWrongLink()
{
- $projectModel = new ProjectModel($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
-
- $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
- $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
-
- $event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'link_id' => 2));
+ $taskFinderModel = new TaskFinderModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
$action = new TaskAssignColorLink($this->container);
$action->setProjectId(1);
+ $action->setParam('link_id', 2);
$action->setParam('color_id', 'red');
- $action->setParam('link_id', 1);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'P1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'T1', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'T2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
+
+ $event = TaskLinkEventBuilder::getInstance($this->container)
+ ->withTaskLinkId(1)
+ ->build();
$this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertEquals('yellow', $task['color_id']);
}
}
diff --git a/tests/units/EventBuilder/TaskLinkEventBuilderTest.php b/tests/units/EventBuilder/TaskLinkEventBuilderTest.php
new file mode 100644
index 00000000..7364d651
--- /dev/null
+++ b/tests/units/EventBuilder/TaskLinkEventBuilderTest.php
@@ -0,0 +1,70 @@
+container);
+ $taskLinkEventBuilder->withTaskLinkId(42);
+ $this->assertNull($taskLinkEventBuilder->build());
+ }
+
+ public function testBuild()
+ {
+ $taskLinkModel = new TaskLinkModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskLinkEventBuilder = new TaskLinkEventBuilder($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'task 1', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'task 2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
+
+ $event = $taskLinkEventBuilder->withTaskLinkId(1)->build();
+
+ $this->assertInstanceOf('Kanboard\Event\TaskLinkEvent', $event);
+ $this->assertNotEmpty($event['task_link']);
+ $this->assertNotEmpty($event['task']);
+ }
+
+ public function testBuildTitle()
+ {
+ $taskLinkModel = new TaskLinkModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskLinkEventBuilder = new TaskLinkEventBuilder($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'task 1', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'task 2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
+
+ $eventData = $taskLinkEventBuilder->withTaskLinkId(1)->build();
+
+ $title = $taskLinkEventBuilder->buildTitleWithAuthor('Foobar', TaskLinkModel::EVENT_CREATE_UPDATE, $eventData->getAll());
+ $this->assertEquals('Foobar set a new internal link for the task #1', $title);
+
+ $title = $taskLinkEventBuilder->buildTitleWithAuthor('Foobar', TaskLinkModel::EVENT_DELETE, $eventData->getAll());
+ $this->assertEquals('Foobar removed an internal link for the task #1', $title);
+
+ $title = $taskLinkEventBuilder->buildTitleWithAuthor('Foobar', 'not found', $eventData->getAll());
+ $this->assertSame('', $title);
+
+ $title = $taskLinkEventBuilder->buildTitleWithoutAuthor(TaskLinkModel::EVENT_CREATE_UPDATE, $eventData->getAll());
+ $this->assertEquals('A new internal link for the task #1 have been defined', $title);
+
+ $title = $taskLinkEventBuilder->buildTitleWithoutAuthor(TaskLinkModel::EVENT_DELETE, $eventData->getAll());
+ $this->assertEquals('Internal link removed for the task #1', $title);
+
+ $title = $taskLinkEventBuilder->buildTitleWithoutAuthor('not found', $eventData->getAll());
+ $this->assertSame('', $title);
+ }
+}
diff --git a/tests/units/Job/TaskLinkEventJobTest.php b/tests/units/Job/TaskLinkEventJobTest.php
new file mode 100644
index 00000000..1949316a
--- /dev/null
+++ b/tests/units/Job/TaskLinkEventJobTest.php
@@ -0,0 +1,65 @@
+container);
+ $taskLinkEventJob->withParams(123, 'foobar');
+
+ $this->assertSame(array(123, 'foobar'), $taskLinkEventJob->getJobParams());
+ }
+
+ public function testWithMissingLink()
+ {
+ $this->container['dispatcher']->addListener(TaskLinkModel::EVENT_CREATE_UPDATE, function() {});
+
+ $taskLinkEventJob = new TaskLinkEventJob($this->container);
+ $taskLinkEventJob->execute(42, TaskLinkModel::EVENT_CREATE_UPDATE);
+
+ $called = $this->container['dispatcher']->getCalledListeners();
+ $this->assertEmpty($called);
+ }
+
+ public function testTriggerCreationEvents()
+ {
+ $this->container['dispatcher']->addListener(TaskLinkModel::EVENT_CREATE_UPDATE, function() {});
+
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'task 1', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'task 2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
+
+ $called = $this->container['dispatcher']->getCalledListeners();
+ $this->assertArrayHasKey(TaskLinkModel::EVENT_CREATE_UPDATE.'.closure', $called);
+ }
+
+ public function testTriggerDeleteEvents()
+ {
+ $this->container['dispatcher']->addListener(TaskLinkModel::EVENT_DELETE, function() {});
+
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'task 1', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'task 2', 'project_id' => 1)));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
+ $this->assertTrue($taskLinkModel->remove(1));
+
+ $called = $this->container['dispatcher']->getCalledListeners();
+ $this->assertArrayHasKey(TaskLinkModel::EVENT_DELETE.'.closure', $called);
+ }
+}
diff --git a/tests/units/Model/NotificationModelTest.php b/tests/units/Model/NotificationModelTest.php
index 889f3349..0bd9db6e 100644
--- a/tests/units/Model/NotificationModelTest.php
+++ b/tests/units/Model/NotificationModelTest.php
@@ -7,6 +7,7 @@ use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\SubtaskModel;
use Kanboard\Model\CommentModel;
use Kanboard\Model\TaskFileModel;
+use Kanboard\Model\TaskLinkModel;
use Kanboard\Model\TaskModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\NotificationModel;
@@ -23,47 +24,38 @@ class NotificationModelTest extends Base
$subtaskModel = new SubtaskModel($this->container);
$commentModel = new CommentModel($this->container);
$taskFileModel = new TaskFileModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test')));
$this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
$this->assertEquals(1, $subtaskModel->create(array('title' => 'test', 'task_id' => 1)));
$this->assertEquals(1, $commentModel->create(array('comment' => 'test', 'task_id' => 1, 'user_id' => 1)));
$this->assertEquals(1, $taskFileModel->create(1, 'test', 'blah', 123));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
$task = $taskFinderModel->getDetails(1);
$subtask = $subtaskModel->getById(1, true);
$comment = $commentModel->getById(1);
$file = $commentModel->getById(1);
+ $tasklink = $taskLinkModel->getById(1);
- $this->assertNotEmpty($task);
- $this->assertNotEmpty($subtask);
- $this->assertNotEmpty($comment);
- $this->assertNotEmpty($file);
-
- foreach (NotificationSubscriber::getSubscribedEvents() as $event_name => $values) {
- $title = $notificationModel->getTitleWithoutAuthor($event_name, array(
- 'task' => $task,
- 'comment' => $comment,
- 'subtask' => $subtask,
- 'file' => $file,
- 'changes' => array()
- ));
-
- $this->assertNotEmpty($title);
-
- $title = $notificationModel->getTitleWithAuthor('foobar', $event_name, array(
+ foreach (NotificationSubscriber::getSubscribedEvents() as $eventName => $values) {
+ $eventData = array(
'task' => $task,
'comment' => $comment,
'subtask' => $subtask,
'file' => $file,
+ 'task_link' => $tasklink,
'changes' => array()
- ));
+ );
- $this->assertNotEmpty($title);
+ $this->assertNotEmpty($notificationModel->getTitleWithoutAuthor($eventName, $eventData));
+ $this->assertNotEmpty($notificationModel->getTitleWithAuthor('Foobar', $eventName, $eventData));
}
$this->assertNotEmpty($notificationModel->getTitleWithoutAuthor(TaskModel::EVENT_OVERDUE, array('tasks' => array(array('id' => 1)))));
- $this->assertNotEmpty($notificationModel->getTitleWithoutAuthor('unkown', array()));
+ $this->assertNotEmpty($notificationModel->getTitleWithoutAuthor('unknown', array()));
}
public function testGetTaskIdFromEvent()
@@ -75,6 +67,7 @@ class NotificationModelTest extends Base
$subtaskModel = new SubtaskModel($this->container);
$commentModel = new CommentModel($this->container);
$taskFileModel = new TaskFileModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test')));
$this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
@@ -86,18 +79,20 @@ class NotificationModelTest extends Base
$subtask = $subtaskModel->getById(1, true);
$comment = $commentModel->getById(1);
$file = $commentModel->getById(1);
+ $tasklink = $taskLinkModel->getById(1);
$this->assertNotEmpty($task);
$this->assertNotEmpty($subtask);
$this->assertNotEmpty($comment);
$this->assertNotEmpty($file);
- foreach (NotificationSubscriber::getSubscribedEvents() as $event_name => $values) {
- $task_id = $notificationModel->getTaskIdFromEvent($event_name, array(
+ foreach (NotificationSubscriber::getSubscribedEvents() as $eventName => $values) {
+ $task_id = $notificationModel->getTaskIdFromEvent($eventName, array(
'task' => $task,
'comment' => $comment,
'subtask' => $subtask,
'file' => $file,
+ 'task_link' => $tasklink,
'changes' => array()
));
diff --git a/tests/units/Model/TaskLinkModelTest.php b/tests/units/Model/TaskLinkModelTest.php
index 78590891..01a7888b 100644
--- a/tests/units/Model/TaskLinkModelTest.php
+++ b/tests/units/Model/TaskLinkModelTest.php
@@ -9,6 +9,34 @@ use Kanboard\Model\ProjectModel;
class TaskLinkModelTest extends Base
{
+ public function testGeyById()
+ {
+ $taskLinkModel = new TaskLinkModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'A')));
+ $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'B')));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 6));
+
+ $taskLink = $taskLinkModel->getById(1);
+ $this->assertEquals(1, $taskLink['id']);
+ $this->assertEquals(1, $taskLink['task_id']);
+ $this->assertEquals(2, $taskLink['opposite_task_id']);
+ $this->assertEquals(6, $taskLink['link_id']);
+ $this->assertEquals(7, $taskLink['opposite_link_id']);
+ $this->assertEquals('is a child of', $taskLink['label']);
+
+ $taskLink = $taskLinkModel->getById(2);
+ $this->assertEquals(2, $taskLink['id']);
+ $this->assertEquals(2, $taskLink['task_id']);
+ $this->assertEquals(1, $taskLink['opposite_task_id']);
+ $this->assertEquals(7, $taskLink['link_id']);
+ $this->assertEquals(6, $taskLink['opposite_link_id']);
+ $this->assertEquals('is a parent of', $taskLink['label']);
+ }
+
// Check postgres issue: "Cardinality violation: 7 ERROR: more than one row returned by a subquery used as an expression"
public function testGetTaskWithMultipleMilestoneLink()
{
diff --git a/tests/units/Notification/MailNotificationTest.php b/tests/units/Notification/MailNotificationTest.php
new file mode 100644
index 00000000..6579d9bc
--- /dev/null
+++ b/tests/units/Notification/MailNotificationTest.php
@@ -0,0 +1,117 @@
+container);
+ $projectModel = new ProjectModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $subtaskModel = new SubtaskModel($this->container);
+ $commentModel = new CommentModel($this->container);
+ $fileModel = new TaskFileModel($this->container);
+ $taskLinkModel = new TaskLinkModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
+ $this->assertEquals(2, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
+ $this->assertEquals(1, $subtaskModel->create(array('title' => 'test', 'task_id' => 1)));
+ $this->assertEquals(1, $commentModel->create(array('comment' => 'test', 'task_id' => 1, 'user_id' => 1)));
+ $this->assertEquals(1, $fileModel->create(1, 'test', 'blah', 123));
+ $this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
+
+ $task = $taskFinderModel->getDetails(1);
+ $subtask = $subtaskModel->getById(1, true);
+ $comment = $commentModel->getById(1);
+ $file = $commentModel->getById(1);
+ $tasklink = $taskLinkModel->getById(1);
+
+ $this->assertNotEmpty($task);
+ $this->assertNotEmpty($subtask);
+ $this->assertNotEmpty($comment);
+ $this->assertNotEmpty($file);
+
+ foreach (NotificationSubscriber::getSubscribedEvents() as $eventName => $values) {
+ $eventData = array(
+ 'task' => $task,
+ 'comment' => $comment,
+ 'subtask' => $subtask,
+ 'file' => $file,
+ 'task_link' => $tasklink,
+ 'changes' => array()
+ );
+ $this->assertNotEmpty($mailNotification->getMailContent($eventName, $eventData));
+ $this->assertNotEmpty($mailNotification->getMailSubject($eventName, $eventData));
+ }
+ }
+
+ public function testSendWithEmailAddress()
+ {
+ $mailNotification = new MailNotification($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $userModel = new UserModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
+ $this->assertTrue($userModel->update(array('id' => 1, 'email' => 'test@localhost')));
+
+ $this->container['emailClient'] = $this
+ ->getMockBuilder('\Kanboard\Core\Mail\Client')
+ ->setConstructorArgs(array($this->container))
+ ->setMethods(array('send'))
+ ->getMock();
+
+ $this->container['emailClient']
+ ->expects($this->once())
+ ->method('send')
+ ->with(
+ $this->equalTo('test@localhost'),
+ $this->equalTo('admin'),
+ $this->equalTo('[test][New task] test (#1)'),
+ $this->stringContains('test')
+ );
+
+ $mailNotification->notifyUser($userModel->getById(1), TaskModel::EVENT_CREATE, array('task' => $taskFinderModel->getDetails(1)));
+ }
+
+ public function testSendWithoutEmailAddress()
+ {
+ $mailNotification = new MailNotification($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $userModel = new UserModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
+
+ $this->container['emailClient'] = $this
+ ->getMockBuilder('\Kanboard\Core\Mail\Client')
+ ->setConstructorArgs(array($this->container))
+ ->setMethods(array('send'))
+ ->getMock();
+
+ $this->container['emailClient']
+ ->expects($this->never())
+ ->method('send');
+
+ $mailNotification->notifyUser($userModel->getById(1), TaskModel::EVENT_CREATE, array('task' => $taskFinderModel->getDetails(1)));
+ }
+}
diff --git a/tests/units/Notification/MailTest.php b/tests/units/Notification/MailTest.php
deleted file mode 100644
index 9f077ac8..00000000
--- a/tests/units/Notification/MailTest.php
+++ /dev/null
@@ -1,117 +0,0 @@
-container);
- $p = new ProjectModel($this->container);
- $tf = new TaskFinderModel($this->container);
- $tc = new TaskCreationModel($this->container);
- $s = new SubtaskModel($this->container);
- $c = new CommentModel($this->container);
- $f = new TaskFileModel($this->container);
-
- $this->assertEquals(1, $p->create(array('name' => 'test')));
- $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
- $this->assertEquals(1, $s->create(array('title' => 'test', 'task_id' => 1)));
- $this->assertEquals(1, $c->create(array('comment' => 'test', 'task_id' => 1, 'user_id' => 1)));
- $this->assertEquals(1, $f->create(1, 'test', 'blah', 123));
-
- $task = $tf->getDetails(1);
- $subtask = $s->getById(1, true);
- $comment = $c->getById(1);
- $file = $c->getById(1);
-
- $this->assertNotEmpty($task);
- $this->assertNotEmpty($subtask);
- $this->assertNotEmpty($comment);
- $this->assertNotEmpty($file);
-
- foreach (NotificationSubscriber::getSubscribedEvents() as $event => $values) {
- $this->assertNotEmpty($en->getMailContent($event, array(
- 'task' => $task,
- 'comment' => $comment,
- 'subtask' => $subtask,
- 'file' => $file,
- 'changes' => array())
- ));
-
- $this->assertNotEmpty($en->getMailSubject($event, array(
- 'task' => $task,
- 'comment' => $comment,
- 'subtask' => $subtask,
- 'file' => $file,
- 'changes' => array())
- ));
- }
- }
-
- public function testSendWithEmailAddress()
- {
- $en = new MailNotification($this->container);
- $p = new ProjectModel($this->container);
- $tf = new TaskFinderModel($this->container);
- $tc = new TaskCreationModel($this->container);
- $u = new UserModel($this->container);
-
- $this->assertEquals(1, $p->create(array('name' => 'test')));
- $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
- $this->assertTrue($u->update(array('id' => 1, 'email' => 'test@localhost')));
-
- $this->container['emailClient'] = $this
- ->getMockBuilder('\Kanboard\Core\Mail\Client')
- ->setConstructorArgs(array($this->container))
- ->setMethods(array('send'))
- ->getMock();
-
- $this->container['emailClient']
- ->expects($this->once())
- ->method('send')
- ->with(
- $this->equalTo('test@localhost'),
- $this->equalTo('admin'),
- $this->equalTo('[test][New task] test (#1)'),
- $this->stringContains('test')
- );
-
- $en->notifyUser($u->getById(1), TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1)));
- }
-
- public function testSendWithoutEmailAddress()
- {
- $en = new MailNotification($this->container);
- $p = new ProjectModel($this->container);
- $tf = new TaskFinderModel($this->container);
- $tc = new TaskCreationModel($this->container);
- $u = new UserModel($this->container);
-
- $this->assertEquals(1, $p->create(array('name' => 'test')));
- $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
-
- $this->container['emailClient'] = $this
- ->getMockBuilder('\Kanboard\Core\Mail\Client')
- ->setConstructorArgs(array($this->container))
- ->setMethods(array('send'))
- ->getMock();
-
- $this->container['emailClient']
- ->expects($this->never())
- ->method('send');
-
- $en->notifyUser($u->getById(1), TaskModel::EVENT_CREATE, array('task' => $tf->getDetails(1)));
- }
-}
diff --git a/tests/units/Notification/WebhookNotificationTest.php b/tests/units/Notification/WebhookNotificationTest.php
new file mode 100644
index 00000000..6fbc349c
--- /dev/null
+++ b/tests/units/Notification/WebhookNotificationTest.php
@@ -0,0 +1,29 @@
+container);
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $this->container['dispatcher']->addSubscriber(new NotificationSubscriber($this->container));
+
+ $configModel->save(array('webhook_url' => 'http://localhost/?task-creation'));
+
+ $this->container['httpClient']
+ ->expects($this->once())
+ ->method('postJson')
+ ->with($this->stringContains('http://localhost/?task-creation&token='), $this->anything());
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
+ }
+}
diff --git a/tests/units/Notification/WebhookTest.php b/tests/units/Notification/WebhookTest.php
deleted file mode 100644
index 5a9eb1c7..00000000
--- a/tests/units/Notification/WebhookTest.php
+++ /dev/null
@@ -1,29 +0,0 @@
-container);
- $p = new ProjectModel($this->container);
- $tc = new TaskCreationModel($this->container);
- $this->container['dispatcher']->addSubscriber(new NotificationSubscriber($this->container));
-
- $c->save(array('webhook_url' => 'http://localhost/?task-creation'));
-
- $this->container['httpClient']
- ->expects($this->once())
- ->method('postJson')
- ->with($this->stringContains('http://localhost/?task-creation&token='), $this->anything());
-
- $this->assertEquals(1, $p->create(array('name' => 'test')));
- $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test')));
- }
-}
--
cgit v1.2.3
From a823cc1d08535539f850711c0b9edb5b648f1960 Mon Sep 17 00:00:00 2001
From: Frederic Guillot
Date: Sat, 23 Jul 2016 14:50:59 -0400
Subject: NotificationModel refactoring
---
app/EventBuilder/BaseEventBuilder.php | 23 ++-
app/EventBuilder/CommentEventBuilder.php | 52 +++++-
app/EventBuilder/EventIteratorBuilder.php | 48 ++++++
app/EventBuilder/ProjectFileEventBuilder.php | 29 +++-
app/EventBuilder/SubtaskEventBuilder.php | 48 +++++-
app/EventBuilder/TaskEventBuilder.php | 102 +++++++++++-
app/EventBuilder/TaskFileEventBuilder.php | 38 ++++-
app/EventBuilder/TaskLinkEventBuilder.php | 2 +-
app/Job/CommentEventJob.php | 2 +-
app/Job/ProjectFileEventJob.php | 2 +-
app/Job/SubtaskEventJob.php | 2 +-
app/Job/TaskEventJob.php | 2 +-
app/Job/TaskFileEventJob.php | 2 +-
app/Job/TaskLinkEventJob.php | 2 +-
app/Locale/bs_BA/translations.php | 6 +-
app/Locale/cs_CZ/translations.php | 6 +-
app/Locale/da_DK/translations.php | 6 +-
app/Locale/de_DE/translations.php | 6 +-
app/Locale/el_GR/translations.php | 6 +-
app/Locale/es_ES/translations.php | 6 +-
app/Locale/fi_FI/translations.php | 6 +-
app/Locale/fr_FR/translations.php | 6 +-
app/Locale/hu_HU/translations.php | 6 +-
app/Locale/id_ID/translations.php | 6 +-
app/Locale/it_IT/translations.php | 6 +-
app/Locale/ja_JP/translations.php | 6 +-
app/Locale/ko_KR/translations.php | 6 +-
app/Locale/my_MY/translations.php | 6 +-
app/Locale/nb_NO/translations.php | 6 +-
app/Locale/nl_NL/translations.php | 6 +-
app/Locale/pl_PL/translations.php | 6 +-
app/Locale/pt_BR/translations.php | 6 +-
app/Locale/pt_PT/translations.php | 6 +-
app/Locale/ru_RU/translations.php | 6 +-
app/Locale/sr_Latn_RS/translations.php | 6 +-
app/Locale/sv_SE/translations.php | 6 +-
app/Locale/th_TH/translations.php | 6 +-
app/Locale/tr_TR/translations.php | 6 +-
app/Locale/zh_CN/translations.php | 6 +-
app/Model/NotificationModel.php | 176 +++++++--------------
app/Template/event/task_assignee_change.php | 2 +-
tests/units/Action/TaskAssignCategoryLinkTest.php | 6 +-
tests/units/Action/TaskAssignColorLinkTest.php | 4 +-
.../units/EventBuilder/CommentEventBuilderTest.php | 4 +-
.../EventBuilder/ProjectFileEventBuilderTest.php | 4 +-
.../units/EventBuilder/SubtaskEventBuilderTest.php | 6 +-
tests/units/EventBuilder/TaskEventBuilderTest.php | 10 +-
.../EventBuilder/TaskFileEventBuilderTest.php | 4 +-
.../EventBuilder/TaskLinkEventBuilderTest.php | 6 +-
49 files changed, 494 insertions(+), 232 deletions(-)
create mode 100644 app/EventBuilder/EventIteratorBuilder.php
(limited to 'tests/units/Action')
diff --git a/app/EventBuilder/BaseEventBuilder.php b/app/EventBuilder/BaseEventBuilder.php
index c677563e..5aa777a0 100644
--- a/app/EventBuilder/BaseEventBuilder.php
+++ b/app/EventBuilder/BaseEventBuilder.php
@@ -19,5 +19,26 @@ abstract class BaseEventBuilder extends Base
* @access public
* @return GenericEvent|null
*/
- abstract public function build();
+ abstract public function buildEvent();
+
+ /**
+ * Get event title with author
+ *
+ * @access public
+ * @param string $author
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ abstract public function buildTitleWithAuthor($author, $eventName, array $eventData);
+
+ /**
+ * Get event title without author
+ *
+ * @access public
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ abstract public function buildTitleWithoutAuthor($eventName, array $eventData);
}
diff --git a/app/EventBuilder/CommentEventBuilder.php b/app/EventBuilder/CommentEventBuilder.php
index 7b4060e4..ba5842a4 100644
--- a/app/EventBuilder/CommentEventBuilder.php
+++ b/app/EventBuilder/CommentEventBuilder.php
@@ -3,6 +3,7 @@
namespace Kanboard\EventBuilder;
use Kanboard\Event\CommentEvent;
+use Kanboard\Model\CommentModel;
/**
* Class CommentEventBuilder
@@ -32,7 +33,7 @@ class CommentEventBuilder extends BaseEventBuilder
* @access public
* @return CommentEvent|null
*/
- public function build()
+ public function buildEvent()
{
$comment = $this->commentModel->getById($this->commentId);
@@ -45,4 +46,53 @@ class CommentEventBuilder extends BaseEventBuilder
'task' => $this->taskFinderModel->getDetails($comment['task_id']),
));
}
+
+ /**
+ * Get event title with author
+ *
+ * @access public
+ * @param string $author
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithAuthor($author, $eventName, array $eventData)
+ {
+ switch ($eventName) {
+ case CommentModel::EVENT_UPDATE:
+ return e('%s updated a comment on the task #%d', $author, $eventData['task']['id']);
+ case CommentModel::EVENT_CREATE:
+ return e('%s commented on the task #%d', $author, $eventData['task']['id']);
+ case CommentModel::EVENT_DELETE:
+ return e('%s removed a comment on the task #%d', $author, $eventData['task']['id']);
+ case CommentModel::EVENT_USER_MENTION:
+ return e('%s mentioned you in a comment on the task #%d', $author, $eventData['task']['id']);
+ default:
+ return '';
+ }
+ }
+
+ /**
+ * Get event title without author
+ *
+ * @access public
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithoutAuthor($eventName, array $eventData)
+ {
+ switch ($eventName) {
+ case CommentModel::EVENT_CREATE:
+ return e('New comment on task #%d', $eventData['comment']['task_id']);
+ case CommentModel::EVENT_UPDATE:
+ return e('Comment updated on task #%d', $eventData['comment']['task_id']);
+ case CommentModel::EVENT_DELETE:
+ return e('Comment removed on task #%d', $eventData['comment']['task_id']);
+ case CommentModel::EVENT_USER_MENTION:
+ return e('You were mentioned in a comment on the task #%d', $eventData['task']['id']);
+ default:
+ return '';
+ }
+ }
}
diff --git a/app/EventBuilder/EventIteratorBuilder.php b/app/EventBuilder/EventIteratorBuilder.php
new file mode 100644
index 00000000..afa146b6
--- /dev/null
+++ b/app/EventBuilder/EventIteratorBuilder.php
@@ -0,0 +1,48 @@
+builders[] = $builder;
+ return $this;
+ }
+
+ public function rewind() {
+ $this->position = 0;
+ }
+
+ /**
+ * @return BaseEventBuilder
+ */
+ public function current() {
+ return $this->builders[$this->position];
+ }
+
+ public function key() {
+ return $this->position;
+ }
+
+ public function next() {
+ ++$this->position;
+ }
+
+ public function valid() {
+ return isset($this->builders[$this->position]);
+ }
+}
diff --git a/app/EventBuilder/ProjectFileEventBuilder.php b/app/EventBuilder/ProjectFileEventBuilder.php
index 70514a99..6698f78a 100644
--- a/app/EventBuilder/ProjectFileEventBuilder.php
+++ b/app/EventBuilder/ProjectFileEventBuilder.php
@@ -33,7 +33,7 @@ class ProjectFileEventBuilder extends BaseEventBuilder
* @access public
* @return GenericEvent|null
*/
- public function build()
+ public function buildEvent()
{
$file = $this->projectFileModel->getById($this->fileId);
@@ -47,4 +47,31 @@ class ProjectFileEventBuilder extends BaseEventBuilder
'project' => $this->projectModel->getById($file['project_id']),
));
}
+
+ /**
+ * Get event title with author
+ *
+ * @access public
+ * @param string $author
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithAuthor($author, $eventName, array $eventData)
+ {
+ return '';
+ }
+
+ /**
+ * Get event title without author
+ *
+ * @access public
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithoutAuthor($eventName, array $eventData)
+ {
+ return '';
+ }
}
diff --git a/app/EventBuilder/SubtaskEventBuilder.php b/app/EventBuilder/SubtaskEventBuilder.php
index f0271257..5f7e831d 100644
--- a/app/EventBuilder/SubtaskEventBuilder.php
+++ b/app/EventBuilder/SubtaskEventBuilder.php
@@ -4,6 +4,7 @@ namespace Kanboard\EventBuilder;
use Kanboard\Event\SubtaskEvent;
use Kanboard\Event\GenericEvent;
+use Kanboard\Model\SubtaskModel;
/**
* Class SubtaskEventBuilder
@@ -59,7 +60,7 @@ class SubtaskEventBuilder extends BaseEventBuilder
* @access public
* @return GenericEvent|null
*/
- public function build()
+ public function buildEvent()
{
$eventData = array();
$eventData['subtask'] = $this->subtaskModel->getById($this->subtaskId, true);
@@ -76,4 +77,49 @@ class SubtaskEventBuilder extends BaseEventBuilder
$eventData['task'] = $this->taskFinderModel->getDetails($eventData['subtask']['task_id']);
return new SubtaskEvent($eventData);
}
+
+ /**
+ * Get event title with author
+ *
+ * @access public
+ * @param string $author
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithAuthor($author, $eventName, array $eventData)
+ {
+ switch ($eventName) {
+ case SubtaskModel::EVENT_UPDATE:
+ return e('%s updated a subtask for the task #%d', $author, $eventData['task']['id']);
+ case SubtaskModel::EVENT_CREATE:
+ return e('%s created a subtask for the task #%d', $author, $eventData['task']['id']);
+ case SubtaskModel::EVENT_DELETE:
+ return e('%s removed a subtask for the task #%d', $author, $eventData['task']['id']);
+ default:
+ return '';
+ }
+ }
+
+ /**
+ * Get event title without author
+ *
+ * @access public
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithoutAuthor($eventName, array $eventData)
+ {
+ switch ($eventName) {
+ case SubtaskModel::EVENT_CREATE:
+ return e('New subtask on task #%d', $eventData['subtask']['task_id']);
+ case SubtaskModel::EVENT_UPDATE:
+ return e('Subtask updated on task #%d', $eventData['subtask']['task_id']);
+ case SubtaskModel::EVENT_DELETE:
+ return e('Subtask removed on task #%d', $eventData['subtask']['task_id']);
+ default:
+ return '';
+ }
+ }
}
diff --git a/app/EventBuilder/TaskEventBuilder.php b/app/EventBuilder/TaskEventBuilder.php
index e7a5653d..aa897632 100644
--- a/app/EventBuilder/TaskEventBuilder.php
+++ b/app/EventBuilder/TaskEventBuilder.php
@@ -3,6 +3,7 @@
namespace Kanboard\EventBuilder;
use Kanboard\Event\TaskEvent;
+use Kanboard\Model\TaskModel;
/**
* Class TaskEventBuilder
@@ -98,7 +99,7 @@ class TaskEventBuilder extends BaseEventBuilder
* @access public
* @return TaskEvent|null
*/
- public function build()
+ public function buildEvent()
{
$eventData = array();
$eventData['task_id'] = $this->taskId;
@@ -120,4 +121,103 @@ class TaskEventBuilder extends BaseEventBuilder
return new TaskEvent(array_merge($eventData, $this->values));
}
+
+ /**
+ * Get event title with author
+ *
+ * @access public
+ * @param string $author
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithAuthor($author, $eventName, array $eventData)
+ {
+ switch ($eventName) {
+ case TaskModel::EVENT_ASSIGNEE_CHANGE:
+ $assignee = $eventData['task']['assignee_name'] ?: $eventData['task']['assignee_username'];
+
+ if (! empty($assignee)) {
+ return e('%s changed the assignee of the task #%d to %s', $author, $eventData['task']['id'], $assignee);
+ }
+
+ return e('%s removed the assignee of the task %s', $author, e('#%d', $eventData['task']['id']));
+ case TaskModel::EVENT_UPDATE:
+ return e('%s updated the task #%d', $author, $eventData['task']['id']);
+ case TaskModel::EVENT_CREATE:
+ return e('%s created the task #%d', $author, $eventData['task']['id']);
+ case TaskModel::EVENT_CLOSE:
+ return e('%s closed the task #%d', $author, $eventData['task']['id']);
+ case TaskModel::EVENT_OPEN:
+ return e('%s opened the task #%d', $author, $eventData['task']['id']);
+ case TaskModel::EVENT_MOVE_COLUMN:
+ return e(
+ '%s moved the task #%d to the column "%s"',
+ $author,
+ $eventData['task']['id'],
+ $eventData['task']['column_title']
+ );
+ case TaskModel::EVENT_MOVE_POSITION:
+ return e(
+ '%s moved the task #%d to the position %d in the column "%s"',
+ $author,
+ $eventData['task']['id'],
+ $eventData['task']['position'],
+ $eventData['task']['column_title']
+ );
+ case TaskModel::EVENT_MOVE_SWIMLANE:
+ if ($eventData['task']['swimlane_id'] == 0) {
+ return e('%s moved the task #%d to the first swimlane', $author, $eventData['task']['id']);
+ }
+
+ return e(
+ '%s moved the task #%d to the swimlane "%s"',
+ $author,
+ $eventData['task']['id'],
+ $eventData['task']['swimlane_name']
+ );
+
+ case TaskModel::EVENT_USER_MENTION:
+ return e('%s mentioned you in the task #%d', $author, $eventData['task']['id']);
+ default:
+ return '';
+ }
+ }
+
+ /**
+ * Get event title without author
+ *
+ * @access public
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithoutAuthor($eventName, array $eventData)
+ {
+ switch ($eventName) {
+ case TaskModel::EVENT_CREATE:
+ return e('New task #%d: %s', $eventData['task']['id'], $eventData['task']['title']);
+ case TaskModel::EVENT_UPDATE:
+ return e('Task updated #%d', $eventData['task']['id']);
+ case TaskModel::EVENT_CLOSE:
+ return e('Task #%d closed', $eventData['task']['id']);
+ case TaskModel::EVENT_OPEN:
+ return e('Task #%d opened', $eventData['task']['id']);
+ case TaskModel::EVENT_MOVE_COLUMN:
+ return e('Column changed for task #%d', $eventData['task']['id']);
+ case TaskModel::EVENT_MOVE_POSITION:
+ return e('New position for task #%d', $eventData['task']['id']);
+ case TaskModel::EVENT_MOVE_SWIMLANE:
+ return e('Swimlane changed for task #%d', $eventData['task']['id']);
+ case TaskModel::EVENT_ASSIGNEE_CHANGE:
+ return e('Assignee changed on task #%d', $eventData['task']['id']);
+ case TaskModel::EVENT_OVERDUE:
+ $nb = count($eventData['tasks']);
+ return $nb > 1 ? e('%d overdue tasks', $nb) : e('Task #%d is overdue', $eventData['tasks'][0]['id']);
+ case TaskModel::EVENT_USER_MENTION:
+ return e('You were mentioned in the task #%d', $eventData['task']['id']);
+ default:
+ return '';
+ }
+ }
}
diff --git a/app/EventBuilder/TaskFileEventBuilder.php b/app/EventBuilder/TaskFileEventBuilder.php
index 7f1ce3b3..8c985cc0 100644
--- a/app/EventBuilder/TaskFileEventBuilder.php
+++ b/app/EventBuilder/TaskFileEventBuilder.php
@@ -4,6 +4,7 @@ namespace Kanboard\EventBuilder;
use Kanboard\Event\TaskFileEvent;
use Kanboard\Event\GenericEvent;
+use Kanboard\Model\TaskFileModel;
/**
* Class TaskFileEventBuilder
@@ -33,7 +34,7 @@ class TaskFileEventBuilder extends BaseEventBuilder
* @access public
* @return GenericEvent|null
*/
- public function build()
+ public function buildEvent()
{
$file = $this->taskFileModel->getById($this->fileId);
@@ -47,4 +48,39 @@ class TaskFileEventBuilder extends BaseEventBuilder
'task' => $this->taskFinderModel->getDetails($file['task_id']),
));
}
+
+ /**
+ * Get event title with author
+ *
+ * @access public
+ * @param string $author
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithAuthor($author, $eventName, array $eventData)
+ {
+ if ($eventName === TaskFileModel::EVENT_CREATE) {
+ return e('%s attached a file to the task #%d', $author, $eventData['task']['id']);
+ }
+
+ return '';
+ }
+
+ /**
+ * Get event title without author
+ *
+ * @access public
+ * @param string $eventName
+ * @param array $eventData
+ * @return string
+ */
+ public function buildTitleWithoutAuthor($eventName, array $eventData)
+ {
+ if ($eventName === TaskFileModel::EVENT_CREATE) {
+ return e('New attachment on task #%d: %s', $eventData['file']['task_id'], $eventData['file']['name']);
+ }
+
+ return '';
+ }
}
diff --git a/app/EventBuilder/TaskLinkEventBuilder.php b/app/EventBuilder/TaskLinkEventBuilder.php
index 8be5299f..f1a3fba2 100644
--- a/app/EventBuilder/TaskLinkEventBuilder.php
+++ b/app/EventBuilder/TaskLinkEventBuilder.php
@@ -33,7 +33,7 @@ class TaskLinkEventBuilder extends BaseEventBuilder
* @access public
* @return TaskLinkEvent|null
*/
- public function build()
+ public function buildEvent()
{
$taskLink = $this->taskLinkModel->getById($this->taskLinkId);
diff --git a/app/Job/CommentEventJob.php b/app/Job/CommentEventJob.php
index c89350ed..47cf8020 100644
--- a/app/Job/CommentEventJob.php
+++ b/app/Job/CommentEventJob.php
@@ -37,7 +37,7 @@ class CommentEventJob extends BaseJob
{
$event = CommentEventBuilder::getInstance($this->container)
->withCommentId($commentId)
- ->build();
+ ->buildEvent();
if ($event !== null) {
$this->dispatcher->dispatch($eventName, $event);
diff --git a/app/Job/ProjectFileEventJob.php b/app/Job/ProjectFileEventJob.php
index d68949c5..45e6ece3 100644
--- a/app/Job/ProjectFileEventJob.php
+++ b/app/Job/ProjectFileEventJob.php
@@ -36,7 +36,7 @@ class ProjectFileEventJob extends BaseJob
{
$event = ProjectFileEventBuilder::getInstance($this->container)
->withFileId($fileId)
- ->build();
+ ->buildEvent();
if ($event !== null) {
$this->dispatcher->dispatch($eventName, $event);
diff --git a/app/Job/SubtaskEventJob.php b/app/Job/SubtaskEventJob.php
index 1dc243ef..85c4d73e 100644
--- a/app/Job/SubtaskEventJob.php
+++ b/app/Job/SubtaskEventJob.php
@@ -39,7 +39,7 @@ class SubtaskEventJob extends BaseJob
$event = SubtaskEventBuilder::getInstance($this->container)
->withSubtaskId($subtaskId)
->withValues($values)
- ->build();
+ ->buildEvent();
if ($event !== null) {
$this->dispatcher->dispatch($eventName, $event);
diff --git a/app/Job/TaskEventJob.php b/app/Job/TaskEventJob.php
index 46f7a16c..7d026a68 100644
--- a/app/Job/TaskEventJob.php
+++ b/app/Job/TaskEventJob.php
@@ -47,7 +47,7 @@ class TaskEventJob extends BaseJob
->withChanges($changes)
->withValues($values)
->withTask($task)
- ->build();
+ ->buildEvent();
if ($event !== null) {
foreach ($eventNames as $eventName) {
diff --git a/app/Job/TaskFileEventJob.php b/app/Job/TaskFileEventJob.php
index de2c40db..293dbf27 100644
--- a/app/Job/TaskFileEventJob.php
+++ b/app/Job/TaskFileEventJob.php
@@ -36,7 +36,7 @@ class TaskFileEventJob extends BaseJob
{
$event = TaskFileEventBuilder::getInstance($this->container)
->withFileId($fileId)
- ->build();
+ ->buildEvent();
if ($event !== null) {
$this->dispatcher->dispatch($eventName, $event);
diff --git a/app/Job/TaskLinkEventJob.php b/app/Job/TaskLinkEventJob.php
index 669608ad..31f62f07 100644
--- a/app/Job/TaskLinkEventJob.php
+++ b/app/Job/TaskLinkEventJob.php
@@ -36,7 +36,7 @@ class TaskLinkEventJob extends BaseJob
{
$event = TaskLinkEventBuilder::getInstance($this->container)
->withTaskLinkId($taskLinkId)
- ->build();
+ ->buildEvent();
if ($event !== null) {
$this->dispatcher->dispatch($eventName, $event);
diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php
index 6a062068..f1529e02 100644
--- a/app/Locale/bs_BA/translations.php
+++ b/app/Locale/bs_BA/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s ažurirao zadatak #%d',
'%s created the task #%d' => '%s kreirao zadatak #%d',
'%s closed the task #%d' => '%s zatvorio zadatak #%d',
- '%s open the task #%d' => '%s otvorio zadatak #%d',
+ '%s opened the task #%d' => '%s otvorio zadatak #%d',
'%s moved the task #%d to the column "%s"' => '%s premjestio zadatak #%d u kolonu "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s premjestio zadatak #%d na poziciju %d u koloni "%s"',
'Activity' => 'Aktivnosti',
'Default values are "%s"' => 'Podrazumijevane vrijednosti su: "%s"',
'Default columns for new projects (Comma-separated)' => 'Podrazumijevane kolone za novi projekat (Odvojene zarezom)',
'Task assignee change' => 'Promijena izvršioca zadatka',
- '%s change the assignee of the task #%d to %s' => '%s zamijeni izvršioca za zadatak #%d u %s',
+ '%s changed the assignee of the task #%d to %s' => '%s zamijeni izvršioca za zadatak #%d u %s',
'%s changed the assignee of the task %s to %s' => '%s promijenio izvršioca za zadatak %s u %s',
'New password for the user "%s"' => 'Nova šifra korisnika "%s"',
'Choose an event' => 'Izaberi događaj',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Stopa valute je uspješno dodana.',
'Unable to add this currency rate.' => 'Nemoguće dodati stopu valute.',
'Webhook URL' => 'Webhook URL',
- '%s remove the assignee of the task %s' => '%s je uklonio izvršioca zadatka %s',
+ '%s removed the assignee of the task %s' => '%s je uklonio izvršioca zadatka %s',
'Enable Gravatar images' => 'Omogući Gravatar slike',
'Information' => 'Informacije',
'Check two factor authentication code' => 'Provjera faktor-dva autentifikacionog koda',
diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php
index b9a4de6e..c7e6e536 100644
--- a/app/Locale/cs_CZ/translations.php
+++ b/app/Locale/cs_CZ/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s aktualizoval úkol #%d ',
'%s created the task #%d' => '%s vytvořil úkol #%d ',
'%s closed the task #%d' => '%s uzavřel úkol #%d ',
- '%s open the task #%d' => '%s znovu otevřel úkol #%d ',
+ '%s opened the task #%d' => '%s znovu otevřel úkol #%d ',
'%s moved the task #%d to the column "%s"' => '%s přesunul úkol #%d do sloupce "%s" ',
'%s moved the task #%d to the position %d in the column "%s"' => '%s přesunul úkol #%d na pozici %d ve sloupci "%s" ',
'Activity' => 'Aktivity',
'Default values are "%s"' => 'Standardní hodnoty jsou: "%s"',
'Default columns for new projects (Comma-separated)' => 'Výchozí sloupce pro nové projekty (odděleny čárkou)',
'Task assignee change' => 'Změna přiřazení uživatelů',
- '%s change the assignee of the task #%d to %s' => '%s změnil přidělení úkolu #%d na uživatele %s',
+ '%s changed the assignee of the task #%d to %s' => '%s změnil přidělení úkolu #%d na uživatele %s',
'%s changed the assignee of the task %s to %s' => '%s změnil přidělení úkolu %s na uživatele %s',
'New password for the user "%s"' => 'Nové heslo pro uživatele "%s"',
'Choose an event' => 'Vybrat událost',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Směnný kurz byl úspěšně přidán.',
'Unable to add this currency rate.' => 'Nelze přidat tento směnný kurz',
'Webhook URL' => 'Webhook URL',
- '%s remove the assignee of the task %s' => '%s odstranil přiřazení úkolu %s ',
+ '%s removed the assignee of the task %s' => '%s odstranil přiřazení úkolu %s ',
'Enable Gravatar images' => 'Aktiviere Gravatar Bilder',
'Information' => 'Informace',
'Check two factor authentication code' => 'Zkontrolujte dvouúrovňový autentifikační klíč',
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index 050a37d9..6cecfaec 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s opdaterede opgaven #%d',
'%s created the task #%d' => '%s oprettede opgaven #%d',
'%s closed the task #%d' => '%s lukkede opgaven #%d',
- '%s open the task #%d' => '%s åbnede opgaven #%d',
+ '%s opened the task #%d' => '%s åbnede opgaven #%d',
'%s moved the task #%d to the column "%s"' => '%s flyttede opgaven #%d til kolonnen "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s flyttede opgaven #%d til position %d i kolonnen "%s"',
'Activity' => 'Aktivitet',
'Default values are "%s"' => 'Standard værdier er "%s"',
'Default columns for new projects (Comma-separated)' => 'Standard kolonne for nye projekter (kommasepareret)',
'Task assignee change' => 'Opgaven ansvarlig ændring',
- '%s change the assignee of the task #%d to %s' => '%s skrift ansvarlig for opgaven #%d til %s',
+ '%s changed the assignee of the task #%d to %s' => '%s skrift ansvarlig for opgaven #%d til %s',
'%s changed the assignee of the task %s to %s' => '%s skift ansvarlig for opgaven %s til %s',
'New password for the user "%s"' => 'Ny adgangskode for brugeren "%s"',
'Choose an event' => 'Vælg et event',
@@ -601,7 +601,7 @@ return array(
// 'The currency rate have been added successfully.' => '',
// 'Unable to add this currency rate.' => '',
// 'Webhook URL' => '',
- // '%s remove the assignee of the task %s' => '',
+ // '%s removed the assignee of the task %s' => '',
// 'Enable Gravatar images' => '',
// 'Information' => '',
// 'Check two factor authentication code' => '',
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index d6c8bf60..d25e7e8a 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s hat die Aufgabe #%d aktualisiert',
'%s created the task #%d' => '%s hat die Aufgabe #%d angelegt',
'%s closed the task #%d' => '%s hat die Aufgabe #%d geschlossen',
- '%s open the task #%d' => '%s hat die Aufgabe #%d geöffnet',
+ '%s opened the task #%d' => '%s hat die Aufgabe #%d geöffnet',
'%s moved the task #%d to the column "%s"' => '%s hat die Aufgabe #%d in die Spalte "%s" verschoben',
'%s moved the task #%d to the position %d in the column "%s"' => '%s hat die Aufgabe #%d an die Position %d in der Spalte "%s" verschoben',
'Activity' => 'Aktivität',
'Default values are "%s"' => 'Die Standardwerte sind "%s"',
'Default columns for new projects (Comma-separated)' => 'Standardspalten für neue Projekte (komma-getrennt)',
'Task assignee change' => 'Zuständigkeit geändert',
- '%s change the assignee of the task #%d to %s' => '%s hat die Zusständigkeit der Aufgabe #%d geändert um %s',
+ '%s changed the assignee of the task #%d to %s' => '%s hat die Zusständigkeit der Aufgabe #%d geändert um %s',
'%s changed the assignee of the task %s to %s' => '%s hat die Zuständigkeit der Aufgabe %s geändert um %s',
'New password for the user "%s"' => 'Neues Passwort des Benutzers "%s"',
'Choose an event' => 'Aktion wählen',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Der Währungskurs wurde erfolgreich hinzugefügt.',
'Unable to add this currency rate.' => 'Währungskurs konnte nicht hinzugefügt werden',
'Webhook URL' => 'Webhook-URL',
- '%s remove the assignee of the task %s' => '%s Zuordnung für die Aufgabe %s entfernen',
+ '%s removed the assignee of the task %s' => '%s Zuordnung für die Aufgabe %s entfernen',
'Enable Gravatar images' => 'Aktiviere Gravatar-Bilder',
'Information' => 'Information',
'Check two factor authentication code' => 'Prüfe Zwei-Faktor-Authentifizierungscode',
diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php
index 87ea68b0..b02207d5 100644
--- a/app/Locale/el_GR/translations.php
+++ b/app/Locale/el_GR/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s ενημέρωσε την εργασία n°%d',
'%s created the task #%d' => '%s δημιούργησε την εργασία n°%d',
'%s closed the task #%d' => '%s έκλεισε την εργασία n°%d',
- '%s open the task #%d' => '%s άνοιξε την εργασία n°%d',
+ '%s opened the task #%d' => '%s άνοιξε την εργασία n°%d',
'%s moved the task #%d to the column "%s"' => '%s μετακίνησε την εργασία n°%d στη στήλη « %s »',
'%s moved the task #%d to the position %d in the column "%s"' => '%s μετακίνησε την εργασία n°%d στη θέση n°%d της στήλης « %s »',
'Activity' => 'Δραστηριότητα',
'Default values are "%s"' => 'Οι προεπιλεγμένες τιμές είναι « %s »',
'Default columns for new projects (Comma-separated)' => 'Προεπιλεγμένες στήλες για νέα έργα (Comma-separated)',
'Task assignee change' => 'Αλλαγή εκδοχέα εργασίας',
- '%s change the assignee of the task #%d to %s' => '%s άλλαξε τον εκδοχέα της εργασίας n˚%d σε %s',
+ '%s changed the assignee of the task #%d to %s' => '%s άλλαξε τον εκδοχέα της εργασίας n˚%d σε %s',
'%s changed the assignee of the task %s to %s' => '%s ενημέρωσε τον εκδοχέα της εργασίας %s σε %s',
'New password for the user "%s"' => 'Νέο password του χρήστη « %s »',
'Choose an event' => 'Επιλογή event',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Η ισοτιμία προστέθηκε με επιτυχία.',
'Unable to add this currency rate.' => 'Αδύνατο να προστεθεί αυτή η ισοτιμία.',
'Webhook URL' => 'Webhook URL',
- '%s remove the assignee of the task %s' => '%s αφαίρεσε τον εκδοχέα της εργασίας %s',
+ '%s removed the assignee of the task %s' => '%s αφαίρεσε τον εκδοχέα της εργασίας %s',
'Enable Gravatar images' => 'Ενεργοποίηση εικόνων Gravatar',
'Information' => 'Πληροφορίες',
'Check two factor authentication code' => 'Ελέγξτε δύο παράγοντες ελέγχου ταυτότητας κωδικού',
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index 1a4bae82..fa59ca07 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s actualizó la tarea #%d',
'%s created the task #%d' => '%s creó la tarea #%d',
'%s closed the task #%d' => '%s cerró la tarea #%d',
- '%s open the task #%d' => '%s abrió la tarea #%d',
+ '%s opened the task #%d' => '%s abrió la tarea #%d',
'%s moved the task #%d to the column "%s"' => '%s movió la tarea #%d a la columna «%s»',
'%s moved the task #%d to the position %d in the column "%s"' => '%s movió la tarea #%d a la posición %d de la columna «%s»',
'Activity' => 'Actividad',
'Default values are "%s"' => 'Los valores por defecto son «%s»',
'Default columns for new projects (Comma-separated)' => 'Columnas por defecto para los nuevos proyectos (separadas mediante comas)',
'Task assignee change' => 'Cambiar responsable de la tarea',
- '%s change the assignee of the task #%d to %s' => '%s cambió el responsable de la tarea #%d por %s',
+ '%s changed the assignee of the task #%d to %s' => '%s cambió el responsable de la tarea #%d por %s',
'%s changed the assignee of the task %s to %s' => '%s cambió el responsable de la tarea %s por %s',
'New password for the user "%s"' => 'Nueva contraseña para el usuario «%s»',
'Choose an event' => 'Seleccione un evento',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'El cambio de moneda se ha añadido correctamente.',
'Unable to add this currency rate.' => 'No se puede añadir este cambio de moneda.',
'Webhook URL' => 'URL del disparador web (webhook)',
- '%s remove the assignee of the task %s' => '%s quita el responsable de la tarea %s',
+ '%s removed the assignee of the task %s' => '%s quita el responsable de la tarea %s',
'Enable Gravatar images' => 'Activar imágenes Gravatar',
'Information' => 'Información',
'Check two factor authentication code' => 'Revisar código de autenticación en dos pasos',
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index 5d37cb82..200a9cde 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s päivitti tehtävää #%d',
'%s created the task #%d' => '%s loi tehtävän #%d',
'%s closed the task #%d' => '%s sulki tehtävän #%d',
- '%s open the task #%d' => '%s avasi tehtävän #%d',
+ '%s opened the task #%d' => '%s avasi tehtävän #%d',
'%s moved the task #%d to the column "%s"' => '%s siirsi tehtävän #%d sarakkeeseen "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s siirsi tehtävän #%d %d. sarakkeessa %s',
'Activity' => 'Toiminta',
'Default values are "%s"' => 'Oletusarvot ovat "%s"',
'Default columns for new projects (Comma-separated)' => 'Oletussarakkeet uusille projekteille',
'Task assignee change' => 'Tehtävän saajan vaihto',
- '%s change the assignee of the task #%d to %s' => '%s vaihtoi tehtävän #%d saajaksi %s',
+ '%s changed the assignee of the task #%d to %s' => '%s vaihtoi tehtävän #%d saajaksi %s',
'%s changed the assignee of the task %s to %s' => '%s vaihtoi tehtävän %s saajaksi %s',
'New password for the user "%s"' => 'Uusi salasana käyttäjälle "%s"',
'Choose an event' => 'Valitse toiminta',
@@ -601,7 +601,7 @@ return array(
// 'The currency rate have been added successfully.' => '',
// 'Unable to add this currency rate.' => '',
// 'Webhook URL' => '',
- // '%s remove the assignee of the task %s' => '',
+ // '%s removed the assignee of the task %s' => '',
// 'Enable Gravatar images' => '',
// 'Information' => '',
// 'Check two factor authentication code' => '',
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index c8f7d343..9f6cf971 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s a mis à jour la tâche n°%d',
'%s created the task #%d' => '%s a créé la tâche n°%d',
'%s closed the task #%d' => '%s a fermé la tâche n°%d',
- '%s open the task #%d' => '%s a ouvert la tâche n°%d',
+ '%s opened the task #%d' => '%s a ouvert la tâche n°%d',
'%s moved the task #%d to the column "%s"' => '%s a déplacé la tâche n°%d dans la colonne « %s »',
'%s moved the task #%d to the position %d in the column "%s"' => '%s a déplacé la tâche n°%d à la position n°%d dans la colonne « %s »',
'Activity' => 'Activité',
'Default values are "%s"' => 'Les valeurs par défaut sont « %s »',
'Default columns for new projects (Comma-separated)' => 'Colonnes par défaut pour les nouveaux projets (séparation par des virgules)',
'Task assignee change' => 'Modification de la personne assignée à une tâche',
- '%s change the assignee of the task #%d to %s' => '%s a changé la personne assignée à la tâche n˚%d pour %s',
+ '%s changed the assignee of the task #%d to %s' => '%s a changé la personne assignée à la tâche n˚%d pour %s',
'%s changed the assignee of the task %s to %s' => '%s a changé la personne assignée à la tâche %s pour %s',
'New password for the user "%s"' => 'Nouveau mot de passe pour l\'utilisateur « %s »',
'Choose an event' => 'Choisir un événement',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Le taux de change a été ajouté avec succès.',
'Unable to add this currency rate.' => 'Impossible d\'ajouter ce taux de change',
'Webhook URL' => 'URL du webhook',
- '%s remove the assignee of the task %s' => '%s a enlevé la personne assignée à la tâche %s',
+ '%s removed the assignee of the task %s' => '%s a enlevé la personne assignée à la tâche %s',
'Enable Gravatar images' => 'Activer les images Gravatar',
'Information' => 'Informations',
'Check two factor authentication code' => 'Vérification du code pour l\'authentification à deux-facteurs',
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index febf8bc0..781a0423 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s frissítette a feladatot #%d',
'%s created the task #%d' => '%s létrehozta a feladatot #%d',
'%s closed the task #%d' => '%s lezárta a feladatot #%d',
- '%s open the task #%d' => '%s megnyitotta a feladatot #%d',
+ '%s opened the task #%d' => '%s megnyitotta a feladatot #%d',
'%s moved the task #%d to the column "%s"' => '%s átmozgatta a feladatot #%d a "%s" oszlopba',
'%s moved the task #%d to the position %d in the column "%s"' => '%s átmozgatta a feladatot #%d a %d pozícióba a "%s" oszlopban',
'Activity' => 'Tevékenységek',
'Default values are "%s"' => 'Az alapértelmezett értékek: %s',
'Default columns for new projects (Comma-separated)' => 'Alapértelmezett oszlopok az új projektekben (vesszővel elválasztva)',
'Task assignee change' => 'Felelős módosítása',
- '%s change the assignee of the task #%d to %s' => '%s a felelőst módosította #%d %s',
+ '%s changed the assignee of the task #%d to %s' => '%s a felelőst módosította #%d %s',
'%s changed the assignee of the task %s to %s' => '%s a felelőst %s módosította: %s',
'New password for the user "%s"' => 'Felhasználó új jelszava: %s',
'Choose an event' => 'Válasszon eseményt',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Az átváltási árfolyammal történő bővítés sikerült',
'Unable to add this currency rate.' => 'Nem sikerült az átváltási árfolyam felvétele',
'Webhook URL' => 'Webhook URL',
- '%s remove the assignee of the task %s' => '%s eltávolította a %s feladathoz rendelt személyt',
+ '%s removed the assignee of the task %s' => '%s eltávolította a %s feladathoz rendelt személyt',
'Enable Gravatar images' => 'Gravatár képek engedélyezése',
'Information' => 'Információ',
'Check two factor authentication code' => 'Két fázisú beléptető kód ellenőrzése',
diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php
index 18a7a72d..26e091ce 100644
--- a/app/Locale/id_ID/translations.php
+++ b/app/Locale/id_ID/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s memperbaharui tugas n°%d',
'%s created the task #%d' => '%s membuat tugas n°%d',
'%s closed the task #%d' => '%s menutup tugas n°%d',
- '%s open the task #%d' => '%s membuka tugas n°%d',
+ '%s opened the task #%d' => '%s membuka tugas n°%d',
'%s moved the task #%d to the column "%s"' => '%s memindahkan tugas n°%d ke kolom « %s »',
'%s moved the task #%d to the position %d in the column "%s"' => '%s memindahkan tugas n°%d ke posisi n°%d dalam kolom « %s »',
'Activity' => 'Aktifitas',
'Default values are "%s"' => 'Standar nilai adalah« %s »',
'Default columns for new projects (Comma-separated)' => 'Kolom default untuk proyek baru (dipisahkan dengan koma)',
'Task assignee change' => 'Mengubah orang ditugaskan untuk tugas',
- '%s change the assignee of the task #%d to %s' => '%s rubah orang yang ditugaskan dari tugas n%d ke %s',
+ '%s changed the assignee of the task #%d to %s' => '%s rubah orang yang ditugaskan dari tugas n%d ke %s',
'%s changed the assignee of the task %s to %s' => '%s mengubah orang yang ditugaskan dari tugas %s ke %s',
'New password for the user "%s"' => 'Kata sandi baru untuk pengguna « %s »',
'Choose an event' => 'Pilih acara',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Nilai tukar mata uang berhasil ditambahkan.',
'Unable to add this currency rate.' => 'Tidak dapat menambahkan nilai tukar mata uang',
'Webhook URL' => 'URL webhook',
- '%s remove the assignee of the task %s' => '%s menghapus penugasan dari tugas %s',
+ '%s removed the assignee of the task %s' => '%s menghapus penugasan dari tugas %s',
'Enable Gravatar images' => 'Mengaktifkan gambar Gravatar',
'Information' => 'Informasi',
'Check two factor authentication code' => 'Cek dua faktor kode otentifikasi',
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index f6c63076..aadbfe5b 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s ha aggiornato il task #%d',
'%s created the task #%d' => '%s ha creato il task #%d',
'%s closed the task #%d' => '%s ha chiuso il task #%d',
- '%s open the task #%d' => '%s ha aperto il task #%d',
+ '%s opened the task #%d' => '%s ha aperto il task #%d',
'%s moved the task #%d to the column "%s"' => '%s ha spostato il task #%d nella colonna "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s ha spostato il task #%d nella posizione %d della colonna "%s"',
'Activity' => 'Attività',
'Default values are "%s"' => 'Valori di default "%s"',
'Default columns for new projects (Comma-separated)' => 'Colonne di default per i nuovi progetti (Separati da virgola)',
'Task assignee change' => 'Cambia l\'assegnatario del task',
- '%s change the assignee of the task #%d to %s' => '%s dai l\'assegnazione del task #%d a %s',
+ '%s changed the assignee of the task #%d to %s' => '%s dai l\'assegnazione del task #%d a %s',
'%s changed the assignee of the task %s to %s' => '%s ha cambiato l\'assegnatario del task %s a %s',
'New password for the user "%s"' => 'Nuova password per l\'utente "%s"',
'Choose an event' => 'Scegli un evento',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Il tasso di cambio è stato aggiunto con successo.',
'Unable to add this currency rate.' => 'Impossibile aggiungere questo tasso di cambio.',
'Webhook URL' => 'URL Webhook',
- '%s remove the assignee of the task %s' => '%s rimuove l\'assegnatario del task %s',
+ '%s removed the assignee of the task %s' => '%s rimuove l\'assegnatario del task %s',
'Enable Gravatar images' => 'Abilita immagini Gravatar',
'Information' => 'Informazioni',
'Check two factor authentication code' => 'Controlla il codice di autenticazione "two-factor"',
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index dab731d2..03fa55ed 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s がタスク #%d を更新しました',
'%s created the task #%d' => '%s がタスク #%d を追加しました',
'%s closed the task #%d' => '%s がタスク #%d をクローズしました',
- '%s open the task #%d' => '%s がタスク #%d をオープンしました',
+ '%s opened the task #%d' => '%s がタスク #%d をオープンしました',
'%s moved the task #%d to the column "%s"' => '%s がタスク #%d をカラム「%s」に移動しました',
'%s moved the task #%d to the position %d in the column "%s"' => '%s がタスク #%d を位置 %d カラム「%s」移動しました',
'Activity' => 'アクティビティ',
'Default values are "%s"' => 'デフォルト値は「%s」',
'Default columns for new projects (Comma-separated)' => '新規プロジェクトのデフォルトカラム (コンマで区切って入力)',
'Task assignee change' => '担当者の変更',
- '%s change the assignee of the task #%d to %s' => '%s がタスク #%d の担当を %s に変更しました',
+ '%s changed the assignee of the task #%d to %s' => '%s がタスク #%d の担当を %s に変更しました',
'%s changed the assignee of the task %s to %s' => '%s がタスク %s の担当を %s に変更しました',
'New password for the user "%s"' => 'ユーザ「%s」の新しいパスワード',
'Choose an event' => 'イベントの選択',
@@ -601,7 +601,7 @@ return array(
// 'The currency rate have been added successfully.' => '',
'Unable to add this currency rate.' => 'この通貨レートを追加できません。',
'Webhook URL' => 'Webhook URL',
- '%s remove the assignee of the task %s' => '%s がタスク「%s」の担当を解除しました。',
+ '%s removed the assignee of the task %s' => '%s がタスク「%s」の担当を解除しました。',
'Enable Gravatar images' => 'Gravatar イメージを有効化',
'Information' => '情報 ',
'Check two factor authentication code' => '2 段認証をチェックする',
diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php
index 0b6007b1..bf140d94 100644
--- a/app/Locale/ko_KR/translations.php
+++ b/app/Locale/ko_KR/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s이 할일#%d을 갱신했습니다',
'%s created the task #%d' => '%s이 할일#%d을 추가했습니다',
'%s closed the task #%d' => '%s이 할일#%d을 닫혔습니다',
- '%s open the task #%d' => '%s이 할일#%d를 오픈했습니다',
+ '%s opened the task #%d' => '%s이 할일#%d를 오픈했습니다',
'%s moved the task #%d to the column "%s"' => '%s이 할일#%d을 칼럼"%s"로 옮겼습니다',
'%s moved the task #%d to the position %d in the column "%s"' => '%s이 할일#%d을 칼럼 "%s"의 %d 위치로 이동시켰습니다',
'Activity' => '활동',
'Default values are "%s"' => '기본 값은 "%s" 입니다',
'Default columns for new projects (Comma-separated)' => '새로운 프로젝트의 기본 칼럼 (콤마(,)로 분리됨)',
'Task assignee change' => '담당자의 변경',
- '%s change the assignee of the task #%d to %s' => '%s이 할일 #%d의 담당을 %s로 변경합니다',
+ '%s changed the assignee of the task #%d to %s' => '%s이 할일 #%d의 담당을 %s로 변경합니다',
'%s changed the assignee of the task %s to %s' => '%s이 할일 %s의 담당을 %s로 변경했습니다',
'New password for the user "%s"' => '사용자 "%s"의 새로운 패스워드',
'Choose an event' => '행사의 선택',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => '통화가 성공적으로 추가되었습니다',
'Unable to add this currency rate.' => '이 통화 환율을 추가할 수 없습니다.',
'Webhook URL' => 'Webhook URL',
- '%s remove the assignee of the task %s' => '%s이 할일 %s의 담당을 삭제했습니다',
+ '%s removed the assignee of the task %s' => '%s이 할일 %s의 담당을 삭제했습니다',
'Enable Gravatar images' => 'Gravatar이미지를 활성화',
'Information' => '정보',
'Check two factor authentication code' => '2단 인증을 체크한다',
diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php
index 3d66b0bb..cf4f399c 100644
--- a/app/Locale/my_MY/translations.php
+++ b/app/Locale/my_MY/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s memperbaharui tugas n°%d',
'%s created the task #%d' => '%s membuat tugas n°%d',
'%s closed the task #%d' => '%s menutup tugas n°%d',
- '%s open the task #%d' => '%s membuka tugas n°%d',
+ '%s opened the task #%d' => '%s membuka tugas n°%d',
'%s moved the task #%d to the column "%s"' => '%s memindahkan tugas n°%d ke kolom « %s »',
'%s moved the task #%d to the position %d in the column "%s"' => '%s memindahkan tugas n°%d ke posisi n°%d dalam kolom « %s »',
'Activity' => 'Aktifitas',
'Default values are "%s"' => 'Standar nilai adalah« %s »',
'Default columns for new projects (Comma-separated)' => 'Kolom default untuk projek baru (dipisahkan dengan koma)',
'Task assignee change' => 'Mengubah orang ditugaskan untuk tugas',
- '%s change the assignee of the task #%d to %s' => '%s rubah orang yang ditugaskan dari tugas n%d ke %s',
+ '%s changed the assignee of the task #%d to %s' => '%s rubah orang yang ditugaskan dari tugas n%d ke %s',
'%s changed the assignee of the task %s to %s' => '%s mengubah orang yang ditugaskan dari tugas %s ke %s',
'New password for the user "%s"' => 'Kata laluan baru untuk pengguna « %s »',
'Choose an event' => 'Pilih sebuah acara',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Nilai tukar mata uang berhasil ditambahkan.',
'Unable to add this currency rate.' => 'Tidak dapat menambahkan nilai tukar mata uang',
'Webhook URL' => 'URL webhook',
- '%s remove the assignee of the task %s' => '%s menghapus penugasan dari tugas %s',
+ '%s removed the assignee of the task %s' => '%s menghapus penugasan dari tugas %s',
'Enable Gravatar images' => 'Mengaktifkan gambar Gravatar',
'Information' => 'Informasi',
'Check two factor authentication code' => 'Cek dua faktor kode otentifikasi',
diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php
index 14e260cb..ce69deb9 100644
--- a/app/Locale/nb_NO/translations.php
+++ b/app/Locale/nb_NO/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s oppdaterte oppgaven #%d',
'%s created the task #%d' => '%s opprettet oppgaven #%d',
'%s closed the task #%d' => '%s lukket oppgaven #%d',
- '%s open the task #%d' => '%s åpnet oppgaven #%d',
+ '%s opened the task #%d' => '%s åpnet oppgaven #%d',
'%s moved the task #%d to the column "%s"' => '%s flyttet oppgaven #%d til kolonnen "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s flyttet oppgaven #%d til posisjonen %d i kolonnen "%s"',
'Activity' => 'Aktivitetslogg',
'Default values are "%s"' => 'Standardverdier er "%s"',
'Default columns for new projects (Comma-separated)' => 'Standard kolonne for nye prosjekter (komma-separert)',
'Task assignee change' => 'Endring av oppgaveansvarlig',
- '%s change the assignee of the task #%d to %s' => '%s endre ansvarlig for oppgaven #%d til %s',
+ '%s changed the assignee of the task #%d to %s' => '%s endre ansvarlig for oppgaven #%d til %s',
'%s changed the assignee of the task %s to %s' => '%s endret ansvarlig for oppgaven %s til %s',
'New password for the user "%s"' => 'Nytt passord for brukeren "%s"',
'Choose an event' => 'Velg en hendelse',
@@ -601,7 +601,7 @@ return array(
// 'The currency rate have been added successfully.' => '',
// 'Unable to add this currency rate.' => '',
// 'Webhook URL' => '',
- // '%s remove the assignee of the task %s' => '',
+ // '%s removed the assignee of the task %s' => '',
// 'Enable Gravatar images' => '',
// 'Information' => '',
// 'Check two factor authentication code' => '',
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index 8b47d514..d5ba7036 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s heeft taak %d aangepast',
'%s created the task #%d' => '%s heeft taak %d aangemaakt',
'%s closed the task #%d' => '%s heeft taak %d gesloten',
- '%s open the task #%d' => '%s a heeft taak %d geopend',
+ '%s opened the task #%d' => '%s a heeft taak %d geopend',
'%s moved the task #%d to the column "%s"' => '%s heeft taak %d verplaatst naar kolom « %s »',
'%s moved the task #%d to the position %d in the column "%s"' => '%s heeft taak %d verplaatst naar positie %d in kolom « %s »',
'Activity' => 'Activiteit',
'Default values are "%s"' => 'Standaardwaarden zijn « %s »',
'Default columns for new projects (Comma-separated)' => 'Standaard kolommen voor nieuw projecten (komma gescheiden)',
'Task assignee change' => 'Taak toegewezene verandering',
- '%s change the assignee of the task #%d to %s' => '%s heeft de toegewezene voor taak %d veranderd in %s',
+ '%s changed the assignee of the task #%d to %s' => '%s heeft de toegewezene voor taak %d veranderd in %s',
'%s changed the assignee of the task %s to %s' => '%s heeft de toegewezene voor taak %s veranderd in %s',
'New password for the user "%s"' => 'Nieuw wachtwoord voor gebruiker « %s »',
'Choose an event' => 'Kies een gebeurtenis',
@@ -601,7 +601,7 @@ return array(
// 'The currency rate have been added successfully.' => '',
// 'Unable to add this currency rate.' => '',
'Webhook URL' => 'Webhook URL',
- // '%s remove the assignee of the task %s' => '',
+ // '%s removed the assignee of the task %s' => '',
// 'Enable Gravatar images' => '',
// 'Information' => '',
// 'Check two factor authentication code' => '',
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index e72649e6..f2570d7c 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s zaktualizował zadanie #%d',
'%s created the task #%d' => '%s utworzył zadanie #%d',
'%s closed the task #%d' => '%s zamknął zadanie #%d',
- '%s open the task #%d' => '%s otworzył zadanie #%d',
+ '%s opened the task #%d' => '%s otworzył zadanie #%d',
'%s moved the task #%d to the column "%s"' => '%s przeniósł zadanie #%d do kolumny "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s przeniósł zadanie #%d na pozycję %d w kolmnie "%s"',
'Activity' => 'Aktywność',
'Default values are "%s"' => 'Domyślne wartości: "%s"',
'Default columns for new projects (Comma-separated)' => 'Domyślne kolumny dla nowych projektów (oddzielone przecinkiem)',
'Task assignee change' => 'Zmień osobę odpowiedzialną',
- '%s change the assignee of the task #%d to %s' => '%s zmienił osobę odpowiedzialną za zadanie #%d na %s',
+ '%s changed the assignee of the task #%d to %s' => '%s zmienił osobę odpowiedzialną za zadanie #%d na %s',
'%s changed the assignee of the task %s to %s' => '%s zmienił osobę odpowiedzialną za zadanie %s na %s',
'New password for the user "%s"' => 'Nowe hasło użytkownika "%s"',
'Choose an event' => 'Wybierz zdarzenie',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Dodano kurs waluty',
'Unable to add this currency rate.' => 'Nie można dodać kursu waluty',
'Webhook URL' => 'Adres webhooka',
- '%s remove the assignee of the task %s' => '%s usunął osobę przypisaną do zadania %s',
+ '%s removed the assignee of the task %s' => '%s usunął osobę przypisaną do zadania %s',
'Enable Gravatar images' => 'Włącz Gravatar',
'Information' => 'Informacje',
'Check two factor authentication code' => 'Sprawdź kod weryfikujący',
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 7b64f0e7..46749043 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s atualizou a tarefa #%d',
'%s created the task #%d' => '%s criou a tarefa #%d',
'%s closed the task #%d' => '%s finalizou a tarefa #%d',
- '%s open the task #%d' => '%s abriu a tarefa #%d',
+ '%s opened the task #%d' => '%s abriu a tarefa #%d',
'%s moved the task #%d to the column "%s"' => '%s moveu a tarefa #%d para a coluna "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s moveu a tarefa #%d para a posição %d na coluna "%s"',
'Activity' => 'Atividade',
'Default values are "%s"' => 'Os valores padrão são "%s"',
'Default columns for new projects (Comma-separated)' => 'Colunas padrão para novos projetos (Separado por vírgula)',
'Task assignee change' => 'Mudar designação da tarefa',
- '%s change the assignee of the task #%d to %s' => '%s mudou a designação da tarefa #%d para %s',
+ '%s changed the assignee of the task #%d to %s' => '%s mudou a designação da tarefa #%d para %s',
'%s changed the assignee of the task %s to %s' => '%s mudou a designação da tarefa %s para %s',
'New password for the user "%s"' => 'Nova senha para o usuário "%s"',
'Choose an event' => 'Escolher um evento',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'A taxa de câmbio foi adicionada com sucesso.',
'Unable to add this currency rate.' => 'Impossível de adicionar essa taxa de câmbio.',
'Webhook URL' => 'URL do webhook',
- '%s remove the assignee of the task %s' => '%s removeu a pessoa designada para a tarefa %s',
+ '%s removed the assignee of the task %s' => '%s removeu a pessoa designada para a tarefa %s',
'Enable Gravatar images' => 'Ativar imagens do Gravatar',
'Information' => 'Informações',
'Check two factor authentication code' => 'Verifique o código de autenticação em duas etapas',
diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php
index 5267b03b..4fd070d1 100644
--- a/app/Locale/pt_PT/translations.php
+++ b/app/Locale/pt_PT/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s actualizou a tarefa #%d',
'%s created the task #%d' => '%s criou a tarefa #%d',
'%s closed the task #%d' => '%s finalizou a tarefa #%d',
- '%s open the task #%d' => '%s abriu a tarefa #%d',
+ '%s opened the task #%d' => '%s abriu a tarefa #%d',
'%s moved the task #%d to the column "%s"' => '%s moveu a tarefa #%d para a coluna "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s moveu a tarefa #%d para a posição %d na coluna "%s"',
'Activity' => 'Actividade',
'Default values are "%s"' => 'Os valores padrão são "%s"',
'Default columns for new projects (Comma-separated)' => 'Colunas padrão para novos projectos (Separado por vírgula)',
'Task assignee change' => 'Mudar assignação da tarefa',
- '%s change the assignee of the task #%d to %s' => '%s mudou a assignação da tarefa #%d para %s',
+ '%s changed the assignee of the task #%d to %s' => '%s mudou a assignação da tarefa #%d para %s',
'%s changed the assignee of the task %s to %s' => '%s mudou a assignação da tarefa %s para %s',
'New password for the user "%s"' => 'Nova senha para o utilizador "%s"',
'Choose an event' => 'Escolher um evento',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'A taxa de câmbio foi adicionada com sucesso.',
'Unable to add this currency rate.' => 'Impossível adicionar essa taxa de câmbio.',
'Webhook URL' => 'URL do webhook',
- '%s remove the assignee of the task %s' => '%s removeu a pessoa assignada à tarefa %s',
+ '%s removed the assignee of the task %s' => '%s removeu a pessoa assignada à tarefa %s',
'Enable Gravatar images' => 'Activar imagem Gravatar',
'Information' => 'Informações',
'Check two factor authentication code' => 'Verificação do código de autenticação com factor duplo',
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index b3682f03..92fba163 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s обновил задачу #%d',
'%s created the task #%d' => '%s создал задачу #%d',
'%s closed the task #%d' => '%s закрыл задачу #%d',
- '%s open the task #%d' => '%s открыл задачу #%d',
+ '%s opened the task #%d' => '%s открыл задачу #%d',
'%s moved the task #%d to the column "%s"' => '%s переместил задачу #%d в колонку "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s переместил задачу #%d на позицию %d в колонке "%s"',
'Activity' => 'Активность',
'Default values are "%s"' => 'Колонки по умолчанию: "%s"',
'Default columns for new projects (Comma-separated)' => 'Колонки по умолчанию для новых проектов (разделять запятой)',
'Task assignee change' => 'Изменен назначенный',
- '%s change the assignee of the task #%d to %s' => '%s сменил назначенного для задачи #%d на %s',
+ '%s changed the assignee of the task #%d to %s' => '%s сменил назначенного для задачи #%d на %s',
'%s changed the assignee of the task %s to %s' => '%s сменил назначенного для задачи %s на %s',
'New password for the user "%s"' => 'Новый пароль для пользователя "%s"',
'Choose an event' => 'Выберите событие',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Курс валюты был успешно добавлен.',
'Unable to add this currency rate.' => 'Невозможно добавить этот курс валюты.',
'Webhook URL' => 'Webhook URL',
- '%s remove the assignee of the task %s' => '%s удалить назначенную задачу %s',
+ '%s removed the assignee of the task %s' => '%s удалить назначенную задачу %s',
'Enable Gravatar images' => 'Включить Gravatar изображения',
'Information' => 'Информация',
'Check two factor authentication code' => 'Проверка кода двухфакторной авторизации',
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index 157d9e2d..6a4bfc68 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s izmenjen zadatak #%d',
'%s created the task #%d' => '%s kreirao zadatak #%d',
'%s closed the task #%d' => '%s zatvorio zadatak #%d',
- '%s open the task #%d' => '%s otvorio zadatak #%d',
+ '%s opened the task #%d' => '%s otvorio zadatak #%d',
'%s moved the task #%d to the column "%s"' => '%s premestio zadatak #%d u kolonu "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s premestio zadatak #%d na pozycję %d w kolmnie "%s"',
'Activity' => 'Aktivnosti',
'Default values are "%s"' => 'Osnovne vrednosti su: "%s"',
'Default columns for new projects (Comma-separated)' => 'Osnovne kolone za novi projekat (Odvojeni zarezom)',
'Task assignee change' => 'Zmień osobę odpowiedzialną',
- '%s change the assignee of the task #%d to %s' => '%s zamena dodele za zadatak #%d na %s',
+ '%s changed the assignee of the task #%d to %s' => '%s zamena dodele za zadatak #%d na %s',
'%s changed the assignee of the task %s to %s' => '%s zamena dodele za zadatak %s na %s',
'New password for the user "%s"' => 'Nova lozinka za korisnika "%s"',
'Choose an event' => 'Izaberi događaj',
@@ -601,7 +601,7 @@ return array(
// 'The currency rate have been added successfully.' => '',
// 'Unable to add this currency rate.' => '',
// 'Webhook URL' => '',
- // '%s remove the assignee of the task %s' => '',
+ // '%s removed the assignee of the task %s' => '',
// 'Enable Gravatar images' => '',
// 'Information' => '',
// 'Check two factor authentication code' => '',
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index e42a801d..7eb46a98 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s uppdaterade uppgiften #%d',
'%s created the task #%d' => '%s skapade uppgiften #%d',
'%s closed the task #%d' => '%s stängde uppgiften #%d',
- '%s open the task #%d' => '%s öppnade uppgiften #%d',
+ '%s opened the task #%d' => '%s öppnade uppgiften #%d',
'%s moved the task #%d to the column "%s"' => '%s flyttade uppgiften #%d till kolumnen "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s flyttade uppgiften #%d till positionen %d i kolumnen "%s"',
'Activity' => 'Aktivitet',
'Default values are "%s"' => 'Standardvärden är "%s"',
'Default columns for new projects (Comma-separated)' => 'Standardkolumner för nya projekt (kommaseparerade)',
'Task assignee change' => 'Ändra tilldelning av uppgiften',
- '%s change the assignee of the task #%d to %s' => '%s byt tilldelning av uppgiften #%d till %s',
+ '%s changed the assignee of the task #%d to %s' => '%s byt tilldelning av uppgiften #%d till %s',
'%s changed the assignee of the task %s to %s' => '%s byt tilldelning av uppgiften %s till %s',
'New password for the user "%s"' => 'Nytt lösenord för användaren "%s"',
'Choose an event' => 'Välj en händelse',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Valutakursen har lagts till.',
'Unable to add this currency rate.' => 'Kunde inte lägga till valutakursen.',
'Webhook URL' => 'Webhook URL',
- '%s remove the assignee of the task %s' => '%s ta bort tilldelningen av uppgiften %s',
+ '%s removed the assignee of the task %s' => '%s ta bort tilldelningen av uppgiften %s',
'Enable Gravatar images' => 'Aktivera Gravatar bilder',
'Information' => 'Information',
'Check two factor authentication code' => 'Kolla tvåfaktorsverifieringskod',
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 56adbdb8..65979753 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s ปรับปรุงงานแล้ว #%d',
'%s created the task #%d' => '%s สร้างงานแล้ว #%d',
'%s closed the task #%d' => '%s ปิดงานแล้ว #%d',
- '%s open the task #%d' => '%s เปิดงานแล้ว #%d',
+ '%s opened the task #%d' => '%s เปิดงานแล้ว #%d',
'%s moved the task #%d to the column "%s"' => '%s ย้ายงานแล้ว #%d ไปที่คอลัมน์ "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s ย้ายงานแล้ว #%d ไปตำแหน่ง %d ในคอลัมน์ที่ "%s"',
'Activity' => 'กิจกรรม',
'Default values are "%s"' => 'ค่าเริ่มต้น "%s"',
'Default columns for new projects (Comma-separated)' => 'คอลัมน์เริ่มต้นสำหรับโปรเจคใหม่ (Comma-separated)',
'Task assignee change' => 'เปลี่ยนการกำหนดบุคคลของงาน',
- '%s change the assignee of the task #%d to %s' => '%s เปลี่ยนผู้รับผิดชอบของงาน #%d เป็น %s',
+ '%s changed the assignee of the task #%d to %s' => '%s เปลี่ยนผู้รับผิดชอบของงาน #%d เป็น %s',
'%s changed the assignee of the task %s to %s' => '%s เปลี่ยนผู้รับผิดชอบของงาน %s เป็น %s',
'New password for the user "%s"' => 'รหัสผ่านใหม่สำหรับผู้ใช้ "%s"',
'Choose an event' => 'เลือกเหตุการณ์',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'เพิ่มอัตราค่าเงินเรียบร้อย',
'Unable to add this currency rate.' => 'ไม่สามารถเพิ่มค่าเงินนี้',
// 'Webhook URL' => '',
- '%s remove the assignee of the task %s' => '%s เอาผู้รับผิดชอบออกจากงาน %s',
+ '%s removed the assignee of the task %s' => '%s เอาผู้รับผิดชอบออกจากงาน %s',
'Enable Gravatar images' => 'สามารถใช้งานภาพ Gravatar',
'Information' => 'ข้อมูลสารสนเทศ',
// 'Check two factor authentication code' => '',
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index 4f4c84cd..5a1b84b8 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s kullanıcısı #%d nolu görevi güncelledi',
'%s created the task #%d' => '%s kullanıcısı #%d nolu görevi oluşturdu',
'%s closed the task #%d' => '%s kullanıcısı #%d nolu görevi kapattı',
- '%s open the task #%d' => '%s kullanıcısı #%d nolu görevi açtı',
+ '%s opened the task #%d' => '%s kullanıcısı #%d nolu görevi açtı',
'%s moved the task #%d to the column "%s"' => '%s kullanıcısı #%d nolu görevi "%s" sütununa taşıdı',
'%s moved the task #%d to the position %d in the column "%s"' => '%s kullanıcısı #%d nolu görevi %d pozisyonu "%s" sütununa taşıdı',
'Activity' => 'Aktivite',
'Default values are "%s"' => 'Varsayılan değerler "%s"',
'Default columns for new projects (Comma-separated)' => 'Yeni projeler için varsayılan sütunlar (virgül ile ayrılmış)',
'Task assignee change' => 'Göreve atanan kullanıcı değişikliği',
- '%s change the assignee of the task #%d to %s' => '%s kullanıcısı #%d nolu görevin sorumlusunu %s olarak değiştirdi',
+ '%s changed the assignee of the task #%d to %s' => '%s kullanıcısı #%d nolu görevin sorumlusunu %s olarak değiştirdi',
'%s changed the assignee of the task %s to %s' => '%s kullanıcısı %s görevinin sorumlusunu %s olarak değiştirdi',
'New password for the user "%s"' => '"%s" kullanıcısı için yeni şifre',
'Choose an event' => 'Bir durum seçin',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => 'Kur başarıyla eklendi',
'Unable to add this currency rate.' => 'Bu kur eklenemedi',
// 'Webhook URL' => '',
- '%s remove the assignee of the task %s' => '%s, %s görevinin atanan bilgisini kaldırdı',
+ '%s removed the assignee of the task %s' => '%s, %s görevinin atanan bilgisini kaldırdı',
'Enable Gravatar images' => 'Gravatar resimlerini kullanıma aç',
'Information' => 'Bilgi',
'Check two factor authentication code' => 'İki kademeli doğrulama kodunu kontrol et',
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index 01eaff17..f173fdff 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -386,14 +386,14 @@ return array(
'%s updated the task #%d' => '%s 更新了任务 #%d',
'%s created the task #%d' => '%s 创建了任务 #%d',
'%s closed the task #%d' => '%s 关闭了任务 #%d',
- '%s open the task #%d' => '%s 开启了任务 #%d',
+ '%s opened the task #%d' => '%s 开启了任务 #%d',
'%s moved the task #%d to the column "%s"' => '%s 将任务 #%d 移动到栏目 "%s"',
'%s moved the task #%d to the position %d in the column "%s"' => '%s将任务#%d移动到"%s"的第 %d 列',
'Activity' => '动态',
'Default values are "%s"' => '默认值为 "%s"',
'Default columns for new projects (Comma-separated)' => '新建项目的默认栏目(用逗号分开)',
'Task assignee change' => '任务分配变更',
- '%s change the assignee of the task #%d to %s' => '%s 将任务 #%d 分配给了 %s',
+ '%s changed the assignee of the task #%d to %s' => '%s 将任务 #%d 分配给了 %s',
'%s changed the assignee of the task %s to %s' => '%s 将任务 %s 分配给 %s',
'New password for the user "%s"' => '用户"%s"的新密码',
'Choose an event' => '选择一个事件',
@@ -601,7 +601,7 @@ return array(
'The currency rate have been added successfully.' => '成功添加汇率。',
'Unable to add this currency rate.' => '无法添加此汇率',
'Webhook URL' => '网络钩子 URL',
- '%s remove the assignee of the task %s' => '%s删除了任务%s的负责人',
+ '%s removed the assignee of the task %s' => '%s删除了任务%s的负责人',
'Enable Gravatar images' => '启用 Gravatar 图像',
'Information' => '信息',
'Check two factor authentication code' => '检查双重认证码',
diff --git a/app/Model/NotificationModel.php b/app/Model/NotificationModel.php
index 39c1f581..803d4f18 100644
--- a/app/Model/NotificationModel.php
+++ b/app/Model/NotificationModel.php
@@ -3,10 +3,15 @@
namespace Kanboard\Model;
use Kanboard\Core\Base;
+use Kanboard\EventBuilder\CommentEventBuilder;
+use Kanboard\EventBuilder\EventIteratorBuilder;
+use Kanboard\EventBuilder\SubtaskEventBuilder;
+use Kanboard\EventBuilder\TaskEventBuilder;
+use Kanboard\EventBuilder\TaskFileEventBuilder;
use Kanboard\EventBuilder\TaskLinkEventBuilder;
/**
- * Notification
+ * Notification Model
*
* @package Kanboard\Model
* @author Frederic Guillot
@@ -17,150 +22,79 @@ class NotificationModel extends Base
* Get the event title with author
*
* @access public
- * @param string $event_author
- * @param string $event_name
- * @param array $event_data
+ * @param string $eventAuthor
+ * @param string $eventName
+ * @param array $eventData
* @return string
*/
- public function getTitleWithAuthor($event_author, $event_name, array $event_data)
+ public function getTitleWithAuthor($eventAuthor, $eventName, array $eventData)
{
- switch ($event_name) {
- case TaskModel::EVENT_ASSIGNEE_CHANGE:
- $assignee = $event_data['task']['assignee_name'] ?: $event_data['task']['assignee_username'];
+ foreach ($this->getIteratorBuilder() as $builder) {
+ $title = $builder->buildTitleWithAuthor($eventAuthor, $eventName, $eventData);
- if (! empty($assignee)) {
- return e('%s change the assignee of the task #%d to %s', $event_author, $event_data['task']['id'], $assignee);
- }
-
- return e('%s remove the assignee of the task %s', $event_author, e('#%d', $event_data['task']['id']));
- case TaskModel::EVENT_UPDATE:
- return e('%s updated the task #%d', $event_author, $event_data['task']['id']);
- case TaskModel::EVENT_CREATE:
- return e('%s created the task #%d', $event_author, $event_data['task']['id']);
- case TaskModel::EVENT_CLOSE:
- return e('%s closed the task #%d', $event_author, $event_data['task']['id']);
- case TaskModel::EVENT_OPEN:
- return e('%s open the task #%d', $event_author, $event_data['task']['id']);
- case TaskModel::EVENT_MOVE_COLUMN:
- return e(
- '%s moved the task #%d to the column "%s"',
- $event_author,
- $event_data['task']['id'],
- $event_data['task']['column_title']
- );
- case TaskModel::EVENT_MOVE_POSITION:
- return e(
- '%s moved the task #%d to the position %d in the column "%s"',
- $event_author,
- $event_data['task']['id'],
- $event_data['task']['position'],
- $event_data['task']['column_title']
- );
- case TaskModel::EVENT_MOVE_SWIMLANE:
- if ($event_data['task']['swimlane_id'] == 0) {
- return e('%s moved the task #%d to the first swimlane', $event_author, $event_data['task']['id']);
- }
-
- return e(
- '%s moved the task #%d to the swimlane "%s"',
- $event_author,
- $event_data['task']['id'],
- $event_data['task']['swimlane_name']
- );
- case SubtaskModel::EVENT_UPDATE:
- return e('%s updated a subtask for the task #%d', $event_author, $event_data['task']['id']);
- case SubtaskModel::EVENT_CREATE:
- return e('%s created a subtask for the task #%d', $event_author, $event_data['task']['id']);
- case SubtaskModel::EVENT_DELETE:
- return e('%s removed a subtask for the task #%d', $event_author, $event_data['task']['id']);
- case CommentModel::EVENT_UPDATE:
- return e('%s updated a comment on the task #%d', $event_author, $event_data['task']['id']);
- case CommentModel::EVENT_CREATE:
- return e('%s commented on the task #%d', $event_author, $event_data['task']['id']);
- case CommentModel::EVENT_DELETE:
- return e('%s removed a comment on the task #%d', $event_author, $event_data['task']['id']);
- case TaskFileModel::EVENT_CREATE:
- return e('%s attached a file to the task #%d', $event_author, $event_data['task']['id']);
- case TaskModel::EVENT_USER_MENTION:
- return e('%s mentioned you in the task #%d', $event_author, $event_data['task']['id']);
- case CommentModel::EVENT_USER_MENTION:
- return e('%s mentioned you in a comment on the task #%d', $event_author, $event_data['task']['id']);
- default:
- return TaskLinkEventBuilder::getInstance($this->container)
- ->buildTitleWithAuthor($event_author, $event_name, $event_data) ?:
- e('Notification');
+ if ($title !== '') {
+ return $title;
+ }
}
+
+ return e('Notification');
}
/**
* Get the event title without author
*
* @access public
- * @param string $event_name
- * @param array $event_data
+ * @param string $eventName
+ * @param array $eventData
* @return string
*/
- public function getTitleWithoutAuthor($event_name, array $event_data)
+ public function getTitleWithoutAuthor($eventName, array $eventData)
{
- switch ($event_name) {
- case TaskFileModel::EVENT_CREATE:
- return e('New attachment on task #%d: %s', $event_data['file']['task_id'], $event_data['file']['name']);
- case CommentModel::EVENT_CREATE:
- return e('New comment on task #%d', $event_data['comment']['task_id']);
- case CommentModel::EVENT_UPDATE:
- return e('Comment updated on task #%d', $event_data['comment']['task_id']);
- case CommentModel::EVENT_DELETE:
- return e('Comment removed on task #%d', $event_data['comment']['task_id']);
- case SubtaskModel::EVENT_CREATE:
- return e('New subtask on task #%d', $event_data['subtask']['task_id']);
- case SubtaskModel::EVENT_UPDATE:
- return e('Subtask updated on task #%d', $event_data['subtask']['task_id']);
- case SubtaskModel::EVENT_DELETE:
- return e('Subtask removed on task #%d', $event_data['subtask']['task_id']);
- case TaskModel::EVENT_CREATE:
- return e('New task #%d: %s', $event_data['task']['id'], $event_data['task']['title']);
- case TaskModel::EVENT_UPDATE:
- return e('Task updated #%d', $event_data['task']['id']);
- case TaskModel::EVENT_CLOSE:
- return e('Task #%d closed', $event_data['task']['id']);
- case TaskModel::EVENT_OPEN:
- return e('Task #%d opened', $event_data['task']['id']);
- case TaskModel::EVENT_MOVE_COLUMN:
- return e('Column changed for task #%d', $event_data['task']['id']);
- case TaskModel::EVENT_MOVE_POSITION:
- return e('New position for task #%d', $event_data['task']['id']);
- case TaskModel::EVENT_MOVE_SWIMLANE:
- return e('Swimlane changed for task #%d', $event_data['task']['id']);
- case TaskModel::EVENT_ASSIGNEE_CHANGE:
- return e('Assignee changed on task #%d', $event_data['task']['id']);
- case TaskModel::EVENT_OVERDUE:
- $nb = count($event_data['tasks']);
- return $nb > 1 ? e('%d overdue tasks', $nb) : e('Task #%d is overdue', $event_data['tasks'][0]['id']);
- case TaskModel::EVENT_USER_MENTION:
- return e('You were mentioned in the task #%d', $event_data['task']['id']);
- case CommentModel::EVENT_USER_MENTION:
- return e('You were mentioned in a comment on the task #%d', $event_data['task']['id']);
- default:
- return TaskLinkEventBuilder::getInstance($this->container)
- ->buildTitleWithoutAuthor($event_name, $event_data) ?:
- e('Notification');
+ foreach ($this->getIteratorBuilder() as $builder) {
+ $title = $builder->buildTitleWithoutAuthor($eventName, $eventData);
+
+ if ($title !== '') {
+ return $title;
+ }
}
+
+ return e('Notification');
}
/**
* Get task id from event
*
* @access public
- * @param string $event_name
- * @param array $event_data
+ * @param string $eventName
+ * @param array $eventData
* @return integer
*/
- public function getTaskIdFromEvent($event_name, array $event_data)
+ public function getTaskIdFromEvent($eventName, array $eventData)
{
- if ($event_name === TaskModel::EVENT_OVERDUE) {
- return $event_data['tasks'][0]['id'];
+ if ($eventName === TaskModel::EVENT_OVERDUE) {
+ return $eventData['tasks'][0]['id'];
}
-
- return isset($event_data['task']['id']) ? $event_data['task']['id'] : 0;
+
+ return isset($eventData['task']['id']) ? $eventData['task']['id'] : 0;
+ }
+
+ /**
+ * Get iterator builder
+ *
+ * @access protected
+ * @return EventIteratorBuilder
+ */
+ protected function getIteratorBuilder()
+ {
+ $iterator = new EventIteratorBuilder();
+ $iterator
+ ->withBuilder(TaskEventBuilder::getInstance($this->container))
+ ->withBuilder(CommentEventBuilder::getInstance($this->container))
+ ->withBuilder(SubtaskEventBuilder::getInstance($this->container))
+ ->withBuilder(TaskFileEventBuilder::getInstance($this->container))
+ ->withBuilder(TaskLinkEventBuilder::getInstance($this->container))
+ ;
+
+ return $iterator;
}
}
diff --git a/app/Template/event/task_assignee_change.php b/app/Template/event/task_assignee_change.php
index 7c962223..7539cd0b 100644
--- a/app/Template/event/task_assignee_change.php
+++ b/app/Template/event/task_assignee_change.php
@@ -8,7 +8,7 @@
$this->text->e($assignee)
) ?>
- = e('%s remove the assignee of the task %s', $this->text->e($author), $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))) ?>
+ = e('%s removed the assignee of the task %s', $this->text->e($author), $this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))) ?>
= $this->dt->datetime($date_creation) ?>
diff --git a/tests/units/Action/TaskAssignCategoryLinkTest.php b/tests/units/Action/TaskAssignCategoryLinkTest.php
index b9d7e9d9..1576f81b 100644
--- a/tests/units/Action/TaskAssignCategoryLinkTest.php
+++ b/tests/units/Action/TaskAssignCategoryLinkTest.php
@@ -33,7 +33,7 @@ class TaskAssignCategoryLinkTest extends Base
$event = TaskLinkEventBuilder::getInstance($this->container)
->withTaskLinkId(1)
- ->build();
+ ->buildEvent();
$this->assertTrue($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
@@ -62,7 +62,7 @@ class TaskAssignCategoryLinkTest extends Base
$event = TaskLinkEventBuilder::getInstance($this->container)
->withTaskLinkId(1)
- ->build();
+ ->buildEvent();
$this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
@@ -91,7 +91,7 @@ class TaskAssignCategoryLinkTest extends Base
$event = TaskLinkEventBuilder::getInstance($this->container)
->withTaskLinkId(1)
- ->build();
+ ->buildEvent();
$this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
diff --git a/tests/units/Action/TaskAssignColorLinkTest.php b/tests/units/Action/TaskAssignColorLinkTest.php
index 27364bc9..77a6c90e 100644
--- a/tests/units/Action/TaskAssignColorLinkTest.php
+++ b/tests/units/Action/TaskAssignColorLinkTest.php
@@ -30,7 +30,7 @@ class TaskAssignColorLinkTest extends Base
$event = TaskLinkEventBuilder::getInstance($this->container)
->withTaskLinkId(1)
- ->build();
+ ->buildEvent();
$this->assertTrue($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
@@ -57,7 +57,7 @@ class TaskAssignColorLinkTest extends Base
$event = TaskLinkEventBuilder::getInstance($this->container)
->withTaskLinkId(1)
- ->build();
+ ->buildEvent();
$this->assertFalse($action->execute($event, TaskLinkModel::EVENT_CREATE_UPDATE));
diff --git a/tests/units/EventBuilder/CommentEventBuilderTest.php b/tests/units/EventBuilder/CommentEventBuilderTest.php
index a490799e..2f6a90b5 100644
--- a/tests/units/EventBuilder/CommentEventBuilderTest.php
+++ b/tests/units/EventBuilder/CommentEventBuilderTest.php
@@ -13,7 +13,7 @@ class CommentEventBuilderTest extends Base
{
$commentEventBuilder = new CommentEventBuilder($this->container);
$commentEventBuilder->withCommentId(42);
- $this->assertNull($commentEventBuilder->build());
+ $this->assertNull($commentEventBuilder->buildEvent());
}
public function testBuild()
@@ -28,7 +28,7 @@ class CommentEventBuilderTest extends Base
$this->assertEquals(1, $commentModel->create(array('task_id' => 1, 'comment' => 'bla bla', 'user_id' => 1)));
$commentEventBuilder->withCommentId(1);
- $event = $commentEventBuilder->build();
+ $event = $commentEventBuilder->buildEvent();
$this->assertInstanceOf('Kanboard\Event\CommentEvent', $event);
$this->assertNotEmpty($event['comment']);
diff --git a/tests/units/EventBuilder/ProjectFileEventBuilderTest.php b/tests/units/EventBuilder/ProjectFileEventBuilderTest.php
index bfe22719..8f5eb87e 100644
--- a/tests/units/EventBuilder/ProjectFileEventBuilderTest.php
+++ b/tests/units/EventBuilder/ProjectFileEventBuilderTest.php
@@ -12,7 +12,7 @@ class ProjectFileEventBuilderTest extends Base
{
$projectFileEventBuilder = new ProjectFileEventBuilder($this->container);
$projectFileEventBuilder->withFileId(42);
- $this->assertNull($projectFileEventBuilder->build());
+ $this->assertNull($projectFileEventBuilder->buildEvent());
}
public function testBuild()
@@ -24,7 +24,7 @@ class ProjectFileEventBuilderTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $projectFileModel->create(1, 'Test', '/tmp/test', 123));
- $event = $projectFileEventBuilder->withFileId(1)->build();
+ $event = $projectFileEventBuilder->withFileId(1)->buildEvent();
$this->assertInstanceOf('Kanboard\Event\ProjectFileEvent', $event);
$this->assertNotEmpty($event['file']);
diff --git a/tests/units/EventBuilder/SubtaskEventBuilderTest.php b/tests/units/EventBuilder/SubtaskEventBuilderTest.php
index 062bdfb4..fe425cb8 100644
--- a/tests/units/EventBuilder/SubtaskEventBuilderTest.php
+++ b/tests/units/EventBuilder/SubtaskEventBuilderTest.php
@@ -13,7 +13,7 @@ class SubtaskEventBuilderTest extends Base
{
$subtaskEventBuilder = new SubtaskEventBuilder($this->container);
$subtaskEventBuilder->withSubtaskId(42);
- $this->assertNull($subtaskEventBuilder->build());
+ $this->assertNull($subtaskEventBuilder->buildEvent());
}
public function testBuildWithoutChanges()
@@ -27,7 +27,7 @@ class SubtaskEventBuilderTest extends Base
$this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
$this->assertEquals(1, $subtaskModel->create(array('task_id' => 1, 'title' => 'test')));
- $event = $subtaskEventBuilder->withSubtaskId(1)->build();
+ $event = $subtaskEventBuilder->withSubtaskId(1)->buildEvent();
$this->assertInstanceOf('Kanboard\Event\SubtaskEvent', $event);
$this->assertNotEmpty($event['subtask']);
@@ -49,7 +49,7 @@ class SubtaskEventBuilderTest extends Base
$event = $subtaskEventBuilder
->withSubtaskId(1)
->withValues(array('title' => 'new title', 'user_id' => 1))
- ->build();
+ ->buildEvent();
$this->assertInstanceOf('Kanboard\Event\SubtaskEvent', $event);
$this->assertNotEmpty($event['subtask']);
diff --git a/tests/units/EventBuilder/TaskEventBuilderTest.php b/tests/units/EventBuilder/TaskEventBuilderTest.php
index e6334fe2..c89dcd85 100644
--- a/tests/units/EventBuilder/TaskEventBuilderTest.php
+++ b/tests/units/EventBuilder/TaskEventBuilderTest.php
@@ -12,7 +12,7 @@ class TaskEventBuilderTest extends Base
{
$taskEventBuilder = new TaskEventBuilder($this->container);
$taskEventBuilder->withTaskId(42);
- $this->assertNull($taskEventBuilder->build());
+ $this->assertNull($taskEventBuilder->buildEvent());
}
public function testBuildWithTask()
@@ -28,7 +28,7 @@ class TaskEventBuilderTest extends Base
->withTaskId(1)
->withTask(array('title' => 'before'))
->withChanges(array('title' => 'after'))
- ->build();
+ ->buildEvent();
$this->assertInstanceOf('Kanboard\Event\TaskEvent', $event);
$this->assertNotEmpty($event['task']);
@@ -45,7 +45,7 @@ class TaskEventBuilderTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
- $event = $taskEventBuilder->withTaskId(1)->build();
+ $event = $taskEventBuilder->withTaskId(1)->buildEvent();
$this->assertInstanceOf('Kanboard\Event\TaskEvent', $event);
$this->assertNotEmpty($event['task']);
@@ -65,7 +65,7 @@ class TaskEventBuilderTest extends Base
$event = $taskEventBuilder
->withTaskId(1)
->withChanges(array('title' => 'new title'))
- ->build();
+ ->buildEvent();
$this->assertInstanceOf('Kanboard\Event\TaskEvent', $event);
$this->assertNotEmpty($event['task']);
@@ -86,7 +86,7 @@ class TaskEventBuilderTest extends Base
->withTaskId(1)
->withChanges(array('title' => 'new title', 'project_id' => 1))
->withValues(array('key' => 'value'))
- ->build();
+ ->buildEvent();
$this->assertInstanceOf('Kanboard\Event\TaskEvent', $event);
$this->assertNotEmpty($event['task']);
diff --git a/tests/units/EventBuilder/TaskFileEventBuilderTest.php b/tests/units/EventBuilder/TaskFileEventBuilderTest.php
index c253b913..c90e18d3 100644
--- a/tests/units/EventBuilder/TaskFileEventBuilderTest.php
+++ b/tests/units/EventBuilder/TaskFileEventBuilderTest.php
@@ -13,7 +13,7 @@ class TaskFileEventBuilderTest extends Base
{
$taskFileEventBuilder = new TaskFileEventBuilder($this->container);
$taskFileEventBuilder->withFileId(42);
- $this->assertNull($taskFileEventBuilder->build());
+ $this->assertNull($taskFileEventBuilder->buildEvent());
}
public function testBuild()
@@ -27,7 +27,7 @@ class TaskFileEventBuilderTest extends Base
$this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
$this->assertEquals(1, $taskFileModel->create(1, 'Test', '/tmp/test', 123));
- $event = $taskFileEventBuilder->withFileId(1)->build();
+ $event = $taskFileEventBuilder->withFileId(1)->buildEvent();
$this->assertInstanceOf('Kanboard\Event\TaskFileEvent', $event);
$this->assertNotEmpty($event['file']);
diff --git a/tests/units/EventBuilder/TaskLinkEventBuilderTest.php b/tests/units/EventBuilder/TaskLinkEventBuilderTest.php
index 7364d651..18508146 100644
--- a/tests/units/EventBuilder/TaskLinkEventBuilderTest.php
+++ b/tests/units/EventBuilder/TaskLinkEventBuilderTest.php
@@ -13,7 +13,7 @@ class TaskLinkEventBuilderTest extends Base
{
$taskLinkEventBuilder = new TaskLinkEventBuilder($this->container);
$taskLinkEventBuilder->withTaskLinkId(42);
- $this->assertNull($taskLinkEventBuilder->build());
+ $this->assertNull($taskLinkEventBuilder->buildEvent());
}
public function testBuild()
@@ -28,7 +28,7 @@ class TaskLinkEventBuilderTest extends Base
$this->assertEquals(2, $taskCreationModel->create(array('title' => 'task 2', 'project_id' => 1)));
$this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
- $event = $taskLinkEventBuilder->withTaskLinkId(1)->build();
+ $event = $taskLinkEventBuilder->withTaskLinkId(1)->buildEvent();
$this->assertInstanceOf('Kanboard\Event\TaskLinkEvent', $event);
$this->assertNotEmpty($event['task_link']);
@@ -47,7 +47,7 @@ class TaskLinkEventBuilderTest extends Base
$this->assertEquals(2, $taskCreationModel->create(array('title' => 'task 2', 'project_id' => 1)));
$this->assertEquals(1, $taskLinkModel->create(1, 2, 1));
- $eventData = $taskLinkEventBuilder->withTaskLinkId(1)->build();
+ $eventData = $taskLinkEventBuilder->withTaskLinkId(1)->buildEvent();
$title = $taskLinkEventBuilder->buildTitleWithAuthor('Foobar', TaskLinkModel::EVENT_CREATE_UPDATE, $eventData->getAll());
$this->assertEquals('Foobar set a new internal link for the task #1', $title);
--
cgit v1.2.3
From 2a42e0e1aae35a9bb7abf054155b516ffab701d4 Mon Sep 17 00:00:00 2001
From: Frederic Guillot
Date: Sat, 23 Jul 2016 18:10:05 -0400
Subject: Added a new automatic action to set due date
---
ChangeLog | 5 +-
app/Action/TaskAssignDueDateOnCreation.php | 96 ++++++++++++++++++++++
app/ServiceProvider/ActionProvider.php | 2 +
.../Action/TaskAssignDueDateOnCreationTest.php | 37 +++++++++
tests/units/Action/TaskUpdateStartDateTest.php | 3 +-
5 files changed, 140 insertions(+), 3 deletions(-)
create mode 100644 app/Action/TaskAssignDueDateOnCreation.php
create mode 100644 tests/units/Action/TaskAssignDueDateOnCreationTest.php
(limited to 'tests/units/Action')
diff --git a/ChangeLog b/ChangeLog
index ee57c86c..01ad5fbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,7 +3,9 @@ Version 1.0.32 (unreleased)
New features:
-* New automated action to close tasks without activity in a specific column
+* New automated actions:
+ - Close tasks without activity in a specific column
+ - Set due date automatically
* Added internal task links to activity stream
* Added new event for removed comments
* Added search filter for task priority
@@ -11,6 +13,7 @@ New features:
Improvements:
+* Internal events management refactoring
* Handle header X-Real-IP to get IP address
* Display project name for task auto-complete fields
* Make search attributes not case sensitive
diff --git a/app/Action/TaskAssignDueDateOnCreation.php b/app/Action/TaskAssignDueDateOnCreation.php
new file mode 100644
index 00000000..79ff765c
--- /dev/null
+++ b/app/Action/TaskAssignDueDateOnCreation.php
@@ -0,0 +1,96 @@
+ t('Duration in days')
+ );
+ }
+
+ /**
+ * Get the required parameter for the event
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getEventRequiredParameters()
+ {
+ return array(
+ 'task_id',
+ 'task' => array(
+ 'project_id',
+ ),
+ );
+ }
+
+ /**
+ * Execute the action (set the task color)
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function doAction(array $data)
+ {
+ $values = array(
+ 'id' => $data['task_id'],
+ 'date_due' => strtotime('+'.$this->getParam('duration').'days'),
+ );
+
+ return $this->taskModificationModel->update($values, false);
+ }
+
+ /**
+ * Check if the event data meet the action condition
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool
+ */
+ public function hasRequiredCondition(array $data)
+ {
+ return true;
+ }
+}
diff --git a/app/ServiceProvider/ActionProvider.php b/app/ServiceProvider/ActionProvider.php
index 9383be12..c76555fa 100644
--- a/app/ServiceProvider/ActionProvider.php
+++ b/app/ServiceProvider/ActionProvider.php
@@ -3,6 +3,7 @@
namespace Kanboard\ServiceProvider;
use Kanboard\Action\TaskAssignColorPriority;
+use Kanboard\Action\TaskAssignDueDateOnCreation;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Kanboard\Core\Action\ActionManager;
@@ -80,6 +81,7 @@ class ActionProvider implements ServiceProviderInterface
$container['actionManager']->register(new TaskMoveColumnUnAssigned($container));
$container['actionManager']->register(new TaskOpen($container));
$container['actionManager']->register(new TaskUpdateStartDate($container));
+ $container['actionManager']->register(new TaskAssignDueDateOnCreation($container));
return $container;
}
diff --git a/tests/units/Action/TaskAssignDueDateOnCreationTest.php b/tests/units/Action/TaskAssignDueDateOnCreationTest.php
new file mode 100644
index 00000000..26c0584e
--- /dev/null
+++ b/tests/units/Action/TaskAssignDueDateOnCreationTest.php
@@ -0,0 +1,37 @@
+container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
+
+ $event = TaskEventBuilder::getInstance($this->container)
+ ->withTaskId(1)
+ ->buildEvent();
+
+ $action = new TaskAssignDueDateOnCreation($this->container);
+ $action->setProjectId(1);
+ $action->setParam('duration', 4);
+
+ $this->assertTrue($action->execute($event, TaskModel::EVENT_CREATE));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertNotEmpty($task);
+ $this->assertEquals(date('Y-m-d', strtotime('+4days')), date('Y-m-d', $task['date_due']));
+ }
+}
diff --git a/tests/units/Action/TaskUpdateStartDateTest.php b/tests/units/Action/TaskUpdateStartDateTest.php
index 8d609b3e..05fac100 100644
--- a/tests/units/Action/TaskUpdateStartDateTest.php
+++ b/tests/units/Action/TaskUpdateStartDateTest.php
@@ -2,7 +2,6 @@
require_once __DIR__.'/../Base.php';
-use Kanboard\Event\GenericEvent;
use Kanboard\Event\TaskEvent;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\TaskFinderModel;
@@ -12,7 +11,7 @@ use Kanboard\Action\TaskUpdateStartDate;
class TaskUpdateStartDateTest extends Base
{
- public function testClose()
+ public function testAction()
{
$projectModel = new ProjectModel($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
--
cgit v1.2.3
From 9b2a32af78ef8fb5424398dc57e3c3f906026272 Mon Sep 17 00:00:00 2001
From: Frederic Guillot
Date: Sat, 23 Jul 2016 18:33:31 -0400
Subject: Add new automatic action to move a task to another column when closed
---
ChangeLog | 1 +
app/Action/Base.php | 2 +-
app/Action/CommentCreation.php | 2 +-
app/Action/CommentCreationMoveTaskColumn.php | 2 +-
app/Action/TaskAssignCategoryColor.php | 2 +-
app/Action/TaskAssignCategoryLabel.php | 2 +-
app/Action/TaskAssignCategoryLink.php | 2 +-
app/Action/TaskAssignColorCategory.php | 2 +-
app/Action/TaskAssignColorColumn.php | 2 +-
app/Action/TaskAssignColorLink.php | 2 +-
app/Action/TaskAssignColorPriority.php | 2 +-
app/Action/TaskAssignColorUser.php | 2 +-
app/Action/TaskAssignCurrentUser.php | 2 +-
app/Action/TaskAssignCurrentUserColumn.php | 2 +-
app/Action/TaskAssignDueDateOnCreation.php | 2 +-
app/Action/TaskAssignSpecificUser.php | 2 +-
app/Action/TaskAssignUser.php | 2 +-
app/Action/TaskClose.php | 2 +-
app/Action/TaskCloseColumn.php | 2 +-
app/Action/TaskCloseNoActivity.php | 2 +-
app/Action/TaskCloseNoActivityColumn.php | 2 +-
app/Action/TaskCreation.php | 2 +-
app/Action/TaskDuplicateAnotherProject.php | 2 +-
app/Action/TaskEmail.php | 2 +-
app/Action/TaskEmailNoActivity.php | 2 +-
app/Action/TaskMoveAnotherProject.php | 2 +-
app/Action/TaskMoveColumnAssigned.php | 2 +-
app/Action/TaskMoveColumnCategoryChange.php | 2 +-
app/Action/TaskMoveColumnClosed.php | 102 ++++++++++++++++++++++++
app/Action/TaskMoveColumnUnAssigned.php | 2 +-
app/Action/TaskOpen.php | 2 +-
app/Action/TaskUpdateStartDate.php | 2 +-
app/Model/TaskPositionModel.php | 19 ++---
app/ServiceProvider/ActionProvider.php | 2 +
tests/units/Action/TaskMoveColumnClosedTest.php | 91 +++++++++++++++++++++
35 files changed, 236 insertions(+), 39 deletions(-)
create mode 100644 app/Action/TaskMoveColumnClosed.php
create mode 100644 tests/units/Action/TaskMoveColumnClosedTest.php
(limited to 'tests/units/Action')
diff --git a/ChangeLog b/ChangeLog
index 01ad5fbd..c9aebc48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ New features:
* New automated actions:
- Close tasks without activity in a specific column
- Set due date automatically
+ - Move a task to another column when closed
* Added internal task links to activity stream
* Added new event for removed comments
* Added search filter for task priority
diff --git a/app/Action/Base.php b/app/Action/Base.php
index e0ed8bde..9a502a08 100644
--- a/app/Action/Base.php
+++ b/app/Action/Base.php
@@ -7,7 +7,7 @@ use Kanboard\Event\GenericEvent;
/**
* Base class for automatic actions
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
abstract class Base extends \Kanboard\Core\Base
diff --git a/app/Action/CommentCreation.php b/app/Action/CommentCreation.php
index 60ca24f7..301d2cf9 100644
--- a/app/Action/CommentCreation.php
+++ b/app/Action/CommentCreation.php
@@ -5,7 +5,7 @@ namespace Kanboard\Action;
/**
* Create automatically a comment from a webhook
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class CommentCreation extends Base
diff --git a/app/Action/CommentCreationMoveTaskColumn.php b/app/Action/CommentCreationMoveTaskColumn.php
index 8ab792ad..d5bdd807 100644
--- a/app/Action/CommentCreationMoveTaskColumn.php
+++ b/app/Action/CommentCreationMoveTaskColumn.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Add a comment of the triggering event to the task description.
*
- * @package action
+ * @package Kanboard\Action
* @author Oren Ben-Kiki
*/
class CommentCreationMoveTaskColumn extends Base
diff --git a/app/Action/TaskAssignCategoryColor.php b/app/Action/TaskAssignCategoryColor.php
index 2df90b2c..9228e1ff 100644
--- a/app/Action/TaskAssignCategoryColor.php
+++ b/app/Action/TaskAssignCategoryColor.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Set a category automatically according to the color
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignCategoryColor extends Base
diff --git a/app/Action/TaskAssignCategoryLabel.php b/app/Action/TaskAssignCategoryLabel.php
index 48299010..c390414e 100644
--- a/app/Action/TaskAssignCategoryLabel.php
+++ b/app/Action/TaskAssignCategoryLabel.php
@@ -5,7 +5,7 @@ namespace Kanboard\Action;
/**
* Set a category automatically according to a label
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignCategoryLabel extends Base
diff --git a/app/Action/TaskAssignCategoryLink.php b/app/Action/TaskAssignCategoryLink.php
index d4a4c0ec..6c4b6c96 100644
--- a/app/Action/TaskAssignCategoryLink.php
+++ b/app/Action/TaskAssignCategoryLink.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskLinkModel;
/**
* Set a category automatically according to a task link
*
- * @package action
+ * @package Kanboard\Action
* @author Olivier Maridat
* @author Frederic Guillot
*/
diff --git a/app/Action/TaskAssignColorCategory.php b/app/Action/TaskAssignColorCategory.php
index 91860be4..a136ffd2 100644
--- a/app/Action/TaskAssignColorCategory.php
+++ b/app/Action/TaskAssignColorCategory.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Assign a color to a specific category
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignColorCategory extends Base
diff --git a/app/Action/TaskAssignColorColumn.php b/app/Action/TaskAssignColorColumn.php
index 6c674b1f..da6e3aed 100644
--- a/app/Action/TaskAssignColorColumn.php
+++ b/app/Action/TaskAssignColorColumn.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Assign a color to a task
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignColorColumn extends Base
diff --git a/app/Action/TaskAssignColorLink.php b/app/Action/TaskAssignColorLink.php
index 9759f622..19c37afe 100644
--- a/app/Action/TaskAssignColorLink.php
+++ b/app/Action/TaskAssignColorLink.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskLinkModel;
/**
* Assign a color to a specific task link
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignColorLink extends Base
diff --git a/app/Action/TaskAssignColorPriority.php b/app/Action/TaskAssignColorPriority.php
index 57000ba8..37f7ffed 100644
--- a/app/Action/TaskAssignColorPriority.php
+++ b/app/Action/TaskAssignColorPriority.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Assign a color to a priority
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignColorPriority extends Base
diff --git a/app/Action/TaskAssignColorUser.php b/app/Action/TaskAssignColorUser.php
index 385db793..468d0198 100644
--- a/app/Action/TaskAssignColorUser.php
+++ b/app/Action/TaskAssignColorUser.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Assign a color to a specific user
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignColorUser extends Base
diff --git a/app/Action/TaskAssignCurrentUser.php b/app/Action/TaskAssignCurrentUser.php
index 997aa98f..dee5e7db 100644
--- a/app/Action/TaskAssignCurrentUser.php
+++ b/app/Action/TaskAssignCurrentUser.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Assign a task to the logged user
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignCurrentUser extends Base
diff --git a/app/Action/TaskAssignCurrentUserColumn.php b/app/Action/TaskAssignCurrentUserColumn.php
index e4eade33..60ada7ef 100644
--- a/app/Action/TaskAssignCurrentUserColumn.php
+++ b/app/Action/TaskAssignCurrentUserColumn.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Assign a task to the logged user on column change
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignCurrentUserColumn extends Base
diff --git a/app/Action/TaskAssignDueDateOnCreation.php b/app/Action/TaskAssignDueDateOnCreation.php
index 79ff765c..5c6e2b61 100644
--- a/app/Action/TaskAssignDueDateOnCreation.php
+++ b/app/Action/TaskAssignDueDateOnCreation.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Set the due date of task
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignDueDateOnCreation extends Base
diff --git a/app/Action/TaskAssignSpecificUser.php b/app/Action/TaskAssignSpecificUser.php
index 2c7dcacd..daf9e1df 100644
--- a/app/Action/TaskAssignSpecificUser.php
+++ b/app/Action/TaskAssignSpecificUser.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Assign a task to a specific user
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskAssignSpecificUser extends Base
diff --git a/app/Action/TaskAssignUser.php b/app/Action/TaskAssignUser.php
index 9ea22986..8727b672 100644
--- a/app/Action/TaskAssignUser.php
+++ b/app/Action/TaskAssignUser.php
@@ -5,7 +5,7 @@ namespace Kanboard\Action;
/**
* Assign a task to someone
*
- * @package action
+ * @package Kanboard\Actionv
* @author Frederic Guillot
*/
class TaskAssignUser extends Base
diff --git a/app/Action/TaskClose.php b/app/Action/TaskClose.php
index 91e8cf43..e476e9ba 100644
--- a/app/Action/TaskClose.php
+++ b/app/Action/TaskClose.php
@@ -5,7 +5,7 @@ namespace Kanboard\Action;
/**
* Close automatically a task
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskClose extends Base
diff --git a/app/Action/TaskCloseColumn.php b/app/Action/TaskCloseColumn.php
index 4f1ffc92..523996f4 100644
--- a/app/Action/TaskCloseColumn.php
+++ b/app/Action/TaskCloseColumn.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Close automatically a task in a specific column
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskCloseColumn extends Base
diff --git a/app/Action/TaskCloseNoActivity.php b/app/Action/TaskCloseNoActivity.php
index 5a10510f..ea724d8c 100644
--- a/app/Action/TaskCloseNoActivity.php
+++ b/app/Action/TaskCloseNoActivity.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Close automatically a task after when inactive
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskCloseNoActivity extends Base
diff --git a/app/Action/TaskCloseNoActivityColumn.php b/app/Action/TaskCloseNoActivityColumn.php
index 7af0b7fc..b2ee5224 100644
--- a/app/Action/TaskCloseNoActivityColumn.php
+++ b/app/Action/TaskCloseNoActivityColumn.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Close automatically a task after inactive and in an defined column
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskCloseNoActivityColumn extends Base
diff --git a/app/Action/TaskCreation.php b/app/Action/TaskCreation.php
index 0620afd3..01d91228 100644
--- a/app/Action/TaskCreation.php
+++ b/app/Action/TaskCreation.php
@@ -5,7 +5,7 @@ namespace Kanboard\Action;
/**
* Create automatically a task from a webhook
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskCreation extends Base
diff --git a/app/Action/TaskDuplicateAnotherProject.php b/app/Action/TaskDuplicateAnotherProject.php
index d6d8d51f..0ad7713c 100644
--- a/app/Action/TaskDuplicateAnotherProject.php
+++ b/app/Action/TaskDuplicateAnotherProject.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Duplicate a task to another project
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskDuplicateAnotherProject extends Base
diff --git a/app/Action/TaskEmail.php b/app/Action/TaskEmail.php
index 526e9aa8..fdfe7987 100644
--- a/app/Action/TaskEmail.php
+++ b/app/Action/TaskEmail.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Email a task to someone
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskEmail extends Base
diff --git a/app/Action/TaskEmailNoActivity.php b/app/Action/TaskEmailNoActivity.php
index c60702fb..cac4281e 100644
--- a/app/Action/TaskEmailNoActivity.php
+++ b/app/Action/TaskEmailNoActivity.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Email a task with no activity
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskEmailNoActivity extends Base
diff --git a/app/Action/TaskMoveAnotherProject.php b/app/Action/TaskMoveAnotherProject.php
index 148b6b0c..0fa22b1b 100644
--- a/app/Action/TaskMoveAnotherProject.php
+++ b/app/Action/TaskMoveAnotherProject.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Move a task to another project
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskMoveAnotherProject extends Base
diff --git a/app/Action/TaskMoveColumnAssigned.php b/app/Action/TaskMoveColumnAssigned.php
index 1c1f657a..1cfe6743 100644
--- a/app/Action/TaskMoveColumnAssigned.php
+++ b/app/Action/TaskMoveColumnAssigned.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Move a task to another column when an assignee is set
*
- * @package action
+ * @package Kanboard\Action
* @author Francois Ferrand
*/
class TaskMoveColumnAssigned extends Base
diff --git a/app/Action/TaskMoveColumnCategoryChange.php b/app/Action/TaskMoveColumnCategoryChange.php
index 4c2b289a..13d6ee4f 100644
--- a/app/Action/TaskMoveColumnCategoryChange.php
+++ b/app/Action/TaskMoveColumnCategoryChange.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Move a task to another column when the category is changed
*
- * @package action
+ * @package Kanboard\Action
* @author Francois Ferrand
*/
class TaskMoveColumnCategoryChange extends Base
diff --git a/app/Action/TaskMoveColumnClosed.php b/app/Action/TaskMoveColumnClosed.php
new file mode 100644
index 00000000..3f3e2124
--- /dev/null
+++ b/app/Action/TaskMoveColumnClosed.php
@@ -0,0 +1,102 @@
+ t('Destination column'),
+ );
+ }
+
+ /**
+ * Get the required parameter for the event
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getEventRequiredParameters()
+ {
+ return array(
+ 'task_id',
+ 'task' => array(
+ 'project_id',
+ 'column_id',
+ 'swimlane_id',
+ 'is_active',
+ )
+ );
+ }
+
+ /**
+ * Execute the action (move the task to another column)
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function doAction(array $data)
+ {
+ return $this->taskPositionModel->movePosition(
+ $data['task']['project_id'],
+ $data['task']['id'],
+ $this->getParam('dest_column_id'),
+ 1,
+ $data['task']['swimlane_id'],
+ false,
+ false
+ );
+ }
+
+ /**
+ * Check if the event data meet the action condition
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool
+ */
+ public function hasRequiredCondition(array $data)
+ {
+ return $data['task']['column_id'] != $this->getParam('dest_column_id') && $data['task']['is_active'] == 0;
+ }
+}
diff --git a/app/Action/TaskMoveColumnUnAssigned.php b/app/Action/TaskMoveColumnUnAssigned.php
index 0e9a8a16..ab63d624 100644
--- a/app/Action/TaskMoveColumnUnAssigned.php
+++ b/app/Action/TaskMoveColumnUnAssigned.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Move a task to another column when an assignee is cleared
*
- * @package action
+ * @package Kanboard\Action
* @author Francois Ferrand
*/
class TaskMoveColumnUnAssigned extends Base
diff --git a/app/Action/TaskOpen.php b/app/Action/TaskOpen.php
index 8e847b8e..49017831 100644
--- a/app/Action/TaskOpen.php
+++ b/app/Action/TaskOpen.php
@@ -5,7 +5,7 @@ namespace Kanboard\Action;
/**
* Open automatically a task
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskOpen extends Base
diff --git a/app/Action/TaskUpdateStartDate.php b/app/Action/TaskUpdateStartDate.php
index cc016da1..160f6ee5 100644
--- a/app/Action/TaskUpdateStartDate.php
+++ b/app/Action/TaskUpdateStartDate.php
@@ -7,7 +7,7 @@ use Kanboard\Model\TaskModel;
/**
* Set the start date of task
*
- * @package action
+ * @package Kanboard\Action
* @author Frederic Guillot
*/
class TaskUpdateStartDate extends Base
diff --git a/app/Model/TaskPositionModel.php b/app/Model/TaskPositionModel.php
index d6d2a0af..3d95a763 100644
--- a/app/Model/TaskPositionModel.php
+++ b/app/Model/TaskPositionModel.php
@@ -16,15 +16,16 @@ class TaskPositionModel extends Base
* Move a task to another column or to another position
*
* @access public
- * @param integer $project_id Project id
- * @param integer $task_id Task id
- * @param integer $column_id Column id
- * @param integer $position Position (must be >= 1)
- * @param integer $swimlane_id Swimlane id
- * @param boolean $fire_events Fire events
- * @return boolean
+ * @param integer $project_id Project id
+ * @param integer $task_id Task id
+ * @param integer $column_id Column id
+ * @param integer $position Position (must be >= 1)
+ * @param integer $swimlane_id Swimlane id
+ * @param boolean $fire_events Fire events
+ * @param bool $onlyOpen Do not move closed tasks
+ * @return bool
*/
- public function movePosition($project_id, $task_id, $column_id, $position, $swimlane_id = 0, $fire_events = true)
+ public function movePosition($project_id, $task_id, $column_id, $position, $swimlane_id = 0, $fire_events = true, $onlyOpen = true)
{
if ($position < 1) {
return false;
@@ -32,7 +33,7 @@ class TaskPositionModel extends Base
$task = $this->taskFinderModel->getById($task_id);
- if ($task['is_active'] == TaskModel::STATUS_CLOSED) {
+ if ($onlyOpen && $task['is_active'] == TaskModel::STATUS_CLOSED) {
return true;
}
diff --git a/app/ServiceProvider/ActionProvider.php b/app/ServiceProvider/ActionProvider.php
index c76555fa..cbc60679 100644
--- a/app/ServiceProvider/ActionProvider.php
+++ b/app/ServiceProvider/ActionProvider.php
@@ -4,6 +4,7 @@ namespace Kanboard\ServiceProvider;
use Kanboard\Action\TaskAssignColorPriority;
use Kanboard\Action\TaskAssignDueDateOnCreation;
+use Kanboard\Action\TaskMoveColumnClosed;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Kanboard\Core\Action\ActionManager;
@@ -78,6 +79,7 @@ class ActionProvider implements ServiceProviderInterface
$container['actionManager']->register(new TaskMoveAnotherProject($container));
$container['actionManager']->register(new TaskMoveColumnAssigned($container));
$container['actionManager']->register(new TaskMoveColumnCategoryChange($container));
+ $container['actionManager']->register(new TaskMoveColumnClosed($container));
$container['actionManager']->register(new TaskMoveColumnUnAssigned($container));
$container['actionManager']->register(new TaskOpen($container));
$container['actionManager']->register(new TaskUpdateStartDate($container));
diff --git a/tests/units/Action/TaskMoveColumnClosedTest.php b/tests/units/Action/TaskMoveColumnClosedTest.php
new file mode 100644
index 00000000..318b995d
--- /dev/null
+++ b/tests/units/Action/TaskMoveColumnClosedTest.php
@@ -0,0 +1,91 @@
+container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'is_active' => 0)));
+
+ $event = TaskEventBuilder::getInstance($this->container)
+ ->withTaskId(1)
+ ->buildEvent();
+
+ $action = new TaskMoveColumnClosed($this->container);
+ $action->setProjectId(1);
+ $action->setParam('dest_column_id', 2);
+
+ $this->assertTrue($action->execute($event, TaskModel::EVENT_CLOSE));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertNotEmpty($task);
+ $this->assertEquals('test', $task['title']);
+ $this->assertEquals(2, $task['column_id']);
+ }
+
+ public function testWhenTaskIsOpen()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
+
+ $event = TaskEventBuilder::getInstance($this->container)
+ ->withTaskId(1)
+ ->buildEvent();
+
+ $action = new TaskMoveColumnClosed($this->container);
+ $action->setProjectId(1);
+ $action->setParam('dest_column_id', 2);
+
+ $this->assertFalse($action->execute($event, TaskModel::EVENT_CLOSE));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertNotEmpty($task);
+ $this->assertEquals('test', $task['title']);
+ $this->assertEquals(1, $task['column_id']);
+ }
+
+ public function testWhenTaskIsAlreadyInDestinationColumn()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(2, $projectModel->create(array('name' => 'test2')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'is_active' => 0, 'column_id' => 2)));
+
+ $event = TaskEventBuilder::getInstance($this->container)
+ ->withTaskId(1)
+ ->buildEvent();
+
+ $action = new TaskMoveColumnClosed($this->container);
+ $action->setProjectId(1);
+ $action->setParam('dest_column_id', 2);
+
+ $this->assertFalse($action->execute($event, TaskModel::EVENT_CLOSE));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertNotEmpty($task);
+ $this->assertEquals('test', $task['title']);
+ $this->assertEquals(2, $task['column_id']);
+ }
+}
--
cgit v1.2.3
From ca45b5592b17d3675a22b7aca49ea49dd9dd57ea Mon Sep 17 00:00:00 2001
From: Frederic Guillot
Date: Sat, 23 Jul 2016 18:59:00 -0400
Subject: Add new automatic action to move the task to another column when not
moved
---
ChangeLog | 1 +
app/Action/TaskMoveColumnNotMovedPeriod.php | 104 +++++++++++++++++++++
app/ServiceProvider/ActionProvider.php | 2 +
.../Action/TaskMoveColumnNotMovedPeriodTest.php | 50 ++++++++++
4 files changed, 157 insertions(+)
create mode 100644 app/Action/TaskMoveColumnNotMovedPeriod.php
create mode 100644 tests/units/Action/TaskMoveColumnNotMovedPeriodTest.php
(limited to 'tests/units/Action')
diff --git a/ChangeLog b/ChangeLog
index c9aebc48..1bc0eed3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ New features:
- Close tasks without activity in a specific column
- Set due date automatically
- Move a task to another column when closed
+ - Move a task to another column when not moved during a given period
* Added internal task links to activity stream
* Added new event for removed comments
* Added search filter for task priority
diff --git a/app/Action/TaskMoveColumnNotMovedPeriod.php b/app/Action/TaskMoveColumnNotMovedPeriod.php
new file mode 100644
index 00000000..87e7e405
--- /dev/null
+++ b/app/Action/TaskMoveColumnNotMovedPeriod.php
@@ -0,0 +1,104 @@
+ t('Duration in days'),
+ 'src_column_id' => t('Source column'),
+ 'dest_column_id' => t('Destination column'),
+ );
+ }
+
+ /**
+ * Get the required parameter for the event
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getEventRequiredParameters()
+ {
+ return array('tasks');
+ }
+
+ /**
+ * Execute the action (close the task)
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function doAction(array $data)
+ {
+ $results = array();
+ $max = $this->getParam('duration') * 86400;
+
+ foreach ($data['tasks'] as $task) {
+ $duration = time() - $task['date_moved'];
+
+ if ($duration > $max && $task['column_id'] == $this->getParam('src_column_id')) {
+ $results[] = $this->taskPositionModel->movePosition(
+ $task['project_id'],
+ $task['id'],
+ $this->getParam('dest_column_id'),
+ 1,
+ $task['swimlane_id'],
+ false
+ );
+ }
+ }
+
+ return in_array(true, $results, true);
+ }
+
+ /**
+ * Check if the event data meet the action condition
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool
+ */
+ public function hasRequiredCondition(array $data)
+ {
+ return count($data['tasks']) > 0;
+ }
+}
diff --git a/app/ServiceProvider/ActionProvider.php b/app/ServiceProvider/ActionProvider.php
index cbc60679..946fbf41 100644
--- a/app/ServiceProvider/ActionProvider.php
+++ b/app/ServiceProvider/ActionProvider.php
@@ -5,6 +5,7 @@ namespace Kanboard\ServiceProvider;
use Kanboard\Action\TaskAssignColorPriority;
use Kanboard\Action\TaskAssignDueDateOnCreation;
use Kanboard\Action\TaskMoveColumnClosed;
+use Kanboard\Action\TaskMoveColumnNotMovedPeriod;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Kanboard\Core\Action\ActionManager;
@@ -80,6 +81,7 @@ class ActionProvider implements ServiceProviderInterface
$container['actionManager']->register(new TaskMoveColumnAssigned($container));
$container['actionManager']->register(new TaskMoveColumnCategoryChange($container));
$container['actionManager']->register(new TaskMoveColumnClosed($container));
+ $container['actionManager']->register(new TaskMoveColumnNotMovedPeriod($container));
$container['actionManager']->register(new TaskMoveColumnUnAssigned($container));
$container['actionManager']->register(new TaskOpen($container));
$container['actionManager']->register(new TaskUpdateStartDate($container));
diff --git a/tests/units/Action/TaskMoveColumnNotMovedPeriodTest.php b/tests/units/Action/TaskMoveColumnNotMovedPeriodTest.php
new file mode 100644
index 00000000..7fa16cf2
--- /dev/null
+++ b/tests/units/Action/TaskMoveColumnNotMovedPeriodTest.php
@@ -0,0 +1,50 @@
+container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $taskFinderModel = new TaskFinderModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
+ $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 3)));
+ $this->assertEquals(3, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test', 'column_id' => 2)));
+
+ $this->container['db']->table(TaskModel::TABLE)->in('id', array(2, 3))->update(array('date_moved' => strtotime('-10days')));
+
+ $tasks = $taskFinderModel->getAll(1);
+ $event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1));
+
+ $action = new TaskMoveColumnNotMovedPeriod($this->container);
+ $action->setProjectId(1);
+ $action->setParam('duration', 2);
+ $action->setParam('src_column_id', 2);
+ $action->setParam('dest_column_id', 3);
+
+ $this->assertTrue($action->execute($event, TaskModel::EVENT_DAILY_CRONJOB));
+
+ $task = $taskFinderModel->getById(1);
+ $this->assertNotEmpty($task);
+ $this->assertEquals(1, $task['column_id']);
+
+ $task = $taskFinderModel->getById(2);
+ $this->assertNotEmpty($task);
+ $this->assertEquals(3, $task['column_id']);
+
+ $task = $taskFinderModel->getById(3);
+ $this->assertNotEmpty($task);
+ $this->assertEquals(3, $task['column_id']);
+ }
+}
--
cgit v1.2.3