summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Lee Yu <heinrich@gitlab.com>2018-11-21 17:23:26 +0800
committerHeinrich Lee Yu <heinrich@gitlab.com>2018-12-06 09:02:33 +0800
commitcb5214f4807676c1a4d1e207814b0b658b0b6979 (patch)
tree05cf8c02debee96d2f1fac7f3eeb73d4ee829ba2
parent0ec5edd5bed6918e27330da3140cf87a008c06f3 (diff)
downloadgitlab-ce-cb5214f4807676c1a4d1e207814b0b658b0b6979.tar.gz
Allow creating label lists with the same label name
-rw-r--r--app/assets/javascripts/boards/components/new_list_dropdown.js4
-rw-r--r--app/assets/javascripts/boards/stores/boards_store.js5
2 files changed, 7 insertions, 2 deletions
diff --git a/app/assets/javascripts/boards/components/new_list_dropdown.js b/app/assets/javascripts/boards/components/new_list_dropdown.js
index f7016561f93..10577da9305 100644
--- a/app/assets/javascripts/boards/components/new_list_dropdown.js
+++ b/app/assets/javascripts/boards/components/new_list_dropdown.js
@@ -37,7 +37,7 @@ export default function initNewListDropdown() {
});
},
renderRow(label) {
- const active = boardsStore.findList('title', label.title);
+ const active = boardsStore.findListByLabelId(label.id);
const $li = $('<li />');
const $a = $('<a />', {
class: active ? `is-active js-board-list-${active.id}` : '',
@@ -63,7 +63,7 @@ export default function initNewListDropdown() {
const label = options.selectedObj;
e.preventDefault();
- if (!boardsStore.findList('title', label.title)) {
+ if (!boardsStore.findListByLabelId(label.id)) {
boardsStore.new({
title: label.title,
position: boardsStore.state.lists.length - 2,
diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js
index cf88a973d33..01fc1cb5af3 100644
--- a/app/assets/javascripts/boards/stores/boards_store.js
+++ b/app/assets/javascripts/boards/stores/boards_store.js
@@ -166,6 +166,11 @@ const boardsStore = {
});
return filteredList[0];
},
+ findListByLabelId(id) {
+ return this.state.lists.find(list => {
+ return list.type === 'label' && list.label.id === id;
+ });
+ },
updateFiltersUrl() {
window.history.pushState(null, null, `?${this.filter.path}`);
},