Skip to content

Commit

Permalink
Duplicate tag color when duplicating projects
Browse files Browse the repository at this point in the history
  • Loading branch information
fguillot committed Oct 2, 2018
1 parent b6e0b9c commit a08d867
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Model/TagDuplicationModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function duplicate($src_project_id, $dst_project_id)
$results = array();

foreach ($tags as $tag) {
$results[] = $this->tagModel->create($dst_project_id, $tag['name']);
$results[] = $this->tagModel->create($dst_project_id, $tag['name'], $tag['color_id']);
}

return ! in_array(false, $results, true);
Expand Down
4 changes: 3 additions & 1 deletion tests/units/Model/TagDuplicationModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ public function testProjectDuplication()

$this->assertEquals(1, $tagModel->create(0, 'Tag 1'));
$this->assertEquals(2, $tagModel->create(1, 'Tag 2'));
$this->assertEquals(3, $tagModel->create(1, 'Tag 3'));
$this->assertEquals(3, $tagModel->create(1, 'Tag 3', 'green'));

$this->assertTrue($tagDuplicationModel->duplicate(1, 2));

$tags = $tagModel->getAllByProject(2);
$this->assertCount(2, $tags);
$this->assertEquals('Tag 2', $tags[0]['name']);
$this->assertEquals('', $tags[0]['color_id']);
$this->assertEquals('Tag 3', $tags[1]['name']);
$this->assertEquals('green', $tags[1]['color_id']);
}
}

0 comments on commit a08d867

Please sign in to comment.