Fix bug: Unable to unassign a task from the API
This commit is contained in:
@@ -37,6 +37,7 @@ Bug fixes:
|
|||||||
* Fix wrong link for category in task footer
|
* Fix wrong link for category in task footer
|
||||||
* Unable to set currency rate with Postgres database
|
* Unable to set currency rate with Postgres database
|
||||||
* Avoid automatic actions that change the color to fire subsequent events
|
* Avoid automatic actions that change the color to fire subsequent events
|
||||||
|
* Unable to unassign a task from the API
|
||||||
|
|
||||||
Version 1.0.23
|
Version 1.0.23
|
||||||
--------------
|
--------------
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class Task extends Base
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($owner_id !== null && ! $this->projectPermission->isAssignable($project_id, $owner_id)) {
|
if ($owner_id !== null && $owner_id != 0 && ! $this->projectPermission->isAssignable($project_id, $owner_id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
58
tests/integration/TaskTest.php
Normal file
58
tests/integration/TaskTest.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__.'/Base.php';
|
||||||
|
|
||||||
|
class TaskTest extends Base
|
||||||
|
{
|
||||||
|
public function testChangeAssigneeToAssignableUser()
|
||||||
|
{
|
||||||
|
$project_id = $this->app->createProject('My project');
|
||||||
|
$this->assertNotFalse($project_id);
|
||||||
|
|
||||||
|
$user_id = $this->app->createUser('user0', 'password');
|
||||||
|
$this->assertNotFalse($user_id);
|
||||||
|
|
||||||
|
$this->assertTrue($this->app->addProjectUser($project_id, $user_id, 'project-member'));
|
||||||
|
|
||||||
|
$task_id = $this->app->createTask(array('project_id' => $project_id, 'title' => 'My task'));
|
||||||
|
$this->assertNotFalse($task_id);
|
||||||
|
|
||||||
|
$this->assertTrue($this->app->updateTask(array('id' => $task_id, 'project_id' => $project_id, 'owner_id' => $user_id)));
|
||||||
|
|
||||||
|
$task = $this->app->getTask($task_id);
|
||||||
|
$this->assertEquals($user_id, $task['owner_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testChangeAssigneeToNotAssignableUser()
|
||||||
|
{
|
||||||
|
$project_id = $this->app->createProject('My project');
|
||||||
|
$this->assertNotFalse($project_id);
|
||||||
|
|
||||||
|
$task_id = $this->app->createTask(array('project_id' => $project_id, 'title' => 'My task'));
|
||||||
|
$this->assertNotFalse($task_id);
|
||||||
|
|
||||||
|
$this->assertFalse($this->app->updateTask(array('id' => $task_id, 'project_id' => $project_id, 'owner_id' => 1)));
|
||||||
|
|
||||||
|
$task = $this->app->getTask($task_id);
|
||||||
|
$this->assertEquals(0, $task['owner_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testChangeAssigneeToNobody()
|
||||||
|
{
|
||||||
|
$project_id = $this->app->createProject('My project');
|
||||||
|
$this->assertNotFalse($project_id);
|
||||||
|
|
||||||
|
$user_id = $this->app->createUser('user1', 'password');
|
||||||
|
$this->assertNotFalse($user_id);
|
||||||
|
|
||||||
|
$this->assertTrue($this->app->addProjectUser($project_id, $user_id, 'project-member'));
|
||||||
|
|
||||||
|
$task_id = $this->app->createTask(array('project_id' => $project_id, 'title' => 'My task', 'owner_id' => $user_id));
|
||||||
|
$this->assertNotFalse($task_id);
|
||||||
|
|
||||||
|
$this->assertTrue($this->app->updateTask(array('id' => $task_id, 'project_id' => $project_id, 'owner_id' => 0)));
|
||||||
|
|
||||||
|
$task = $this->app->getTask($task_id);
|
||||||
|
$this->assertEquals(0, $task['owner_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user