summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-07-02 11:50:32 -0400
committerFrederic Guillot <fred@kanboard.net>2016-07-02 11:50:32 -0400
commit853189a43fff8b8b64f18029a35ac910b14932e8 (patch)
tree53a4b6fd29124de69ce20ea9ec2d0fb7caa1d297 /app
parent6db72521eab77ebcb5f8bb196fe72e8f4f8a8c34 (diff)
Do not create empty tags and remove tags only when necessary
Diffstat (limited to 'app')
-rw-r--r--app/Helper/TaskHelper.php1
-rw-r--r--app/Model/TaskModificationModel.php2
-rw-r--r--app/Model/TaskTagModel.php1
3 files changed, 2 insertions, 2 deletions
diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php
index ce39eb2a..84b41e42 100644
--- a/app/Helper/TaskHelper.php
+++ b/app/Helper/TaskHelper.php
@@ -70,6 +70,7 @@ class TaskHelper extends Base
$options = $this->tagModel->getAssignableList($project['id']);
$html = $this->helper->form->label(t('Tags'), 'tags[]');
+ $html .= '<input type="hidden" name="tags[]" value="">';
$html .= '<select name="tags[]" id="form-tags" class="tag-autocomplete" multiple>';
foreach ($options as $tag) {
diff --git a/app/Model/TaskModificationModel.php b/app/Model/TaskModificationModel.php
index 1b176a41..be5f53c8 100644
--- a/app/Model/TaskModificationModel.php
+++ b/app/Model/TaskModificationModel.php
@@ -108,8 +108,6 @@ class TaskModificationModel extends Base
if (isset($values['tags'])) {
$this->taskTagModel->save($original_task['project_id'], $values['id'], $values['tags']);
unset($values['tags']);
- } else {
- $this->taskTagModel->save($original_task['project_id'], $values['id'], array());
}
}
}
diff --git a/app/Model/TaskTagModel.php b/app/Model/TaskTagModel.php
index 91dfd224..2a08e867 100644
--- a/app/Model/TaskTagModel.php
+++ b/app/Model/TaskTagModel.php
@@ -82,6 +82,7 @@ class TaskTagModel extends Base
public function save($project_id, $task_id, array $tags)
{
$task_tags = $this->getList($task_id);
+ $tags = array_filter($tags);
return $this->associateTags($project_id, $task_id, $task_tags, $tags) &&
$this->dissociateTags($task_id, $task_tags, $tags);