diff options
-rw-r--r-- | app/Model/BoardModel.php | 18 | ||||
-rw-r--r-- | tests/units/Model/BoardTest.php | 7 |
2 files changed, 11 insertions, 14 deletions
diff --git a/app/Model/BoardModel.php b/app/Model/BoardModel.php index f83b7cc2..ad590ff7 100644 --- a/app/Model/BoardModel.php +++ b/app/Model/BoardModel.php @@ -31,20 +31,16 @@ class BoardModel extends Base */ public function getUserColumns() { - $column_names = explode(',', $this->configModel->get('board_columns', implode(',', $this->getDefaultColumns()))); + $column_names = array_unique(explode_csv_field($this->configModel->get('board_columns', implode(',', $this->getDefaultColumns())))); $columns = array(); foreach ($column_names as $column_name) { - $column_name = trim($column_name); - - if (! empty($column_name)) { - $columns[] = array( - 'title' => $column_name, - 'task_limit' => 0, - 'description' => '', - 'hide_in_dashboard' => 0, - ); - } + $columns[] = array( + 'title' => $column_name, + 'task_limit' => 0, + 'description' => '', + 'hide_in_dashboard' => 0, + ); } return $columns; diff --git a/tests/units/Model/BoardTest.php b/tests/units/Model/BoardTest.php index 9f540c63..4da06ffc 100644 --- a/tests/units/Model/BoardTest.php +++ b/tests/units/Model/BoardTest.php @@ -26,8 +26,8 @@ class BoardTest extends Base $this->assertEquals('Work in progress', $columns[3]); $this->assertEquals('Done', $columns[4]); - // Custom columns: spaces should be trimed and no empty columns - $input = ' column #1 , column #2, '; + // Custom columns: spaces should be trimed, no empty columns and no duplicates + $input = ' column #1 , column #2,column #1 ,column #3 , '; $this->assertTrue($c->save(array('board_columns' => $input))); $this->container['memoryCache']->flush(); @@ -37,8 +37,9 @@ class BoardTest extends Base $columns = $columnModel->getList(2); $this->assertTrue(is_array($columns)); - $this->assertEquals(2, count($columns)); + $this->assertEquals(3, count($columns)); $this->assertEquals('column #1', $columns[5]); $this->assertEquals('column #2', $columns[6]); + $this->assertEquals('column #3', $columns[7]); } } |