From 36e363d33d5f75aeb75c552d4b325ed8c2d6105f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 21 Jan 2020 21:08:54 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/boards/models/list.js | 22 +------------------ .../javascripts/boards/stores/boards_store.js | 25 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 22 deletions(-) (limited to 'app/assets/javascripts/boards') diff --git a/app/assets/javascripts/boards/models/list.js b/app/assets/javascripts/boards/models/list.js index b232fea0882..299864c279b 100644 --- a/app/assets/javascripts/boards/models/list.js +++ b/app/assets/javascripts/boards/models/list.js @@ -83,27 +83,7 @@ class List { } save() { - const entity = this.label || this.assignee || this.milestone; - let entityType = ''; - if (this.label) { - entityType = 'label_id'; - } else if (this.assignee) { - entityType = 'assignee_id'; - } else if (IS_EE && this.milestone) { - entityType = 'milestone_id'; - } - - return boardsStore - .createList(entity.id, entityType) - .then(res => res.data) - .then(data => { - this.id = data.id; - this.type = data.list_type; - this.position = data.position; - this.label = data.label; - - return this.getIssues(); - }); + return boardsStore.saveList(this); } destroy() { diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js index 8b737d1dab0..df8b7a2df6c 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js +++ b/app/assets/javascripts/boards/stores/boards_store.js @@ -1,4 +1,4 @@ -/* eslint-disable no-shadow */ +/* eslint-disable no-shadow, no-param-reassign */ /* global List */ import $ from 'jquery'; @@ -408,6 +408,29 @@ const boardsStore = { return axios.delete(`${this.state.endpoints.listsEndpoint}/${id}`); }, + saveList(list) { + const entity = list.label || list.assignee || list.milestone; + let entityType = ''; + if (list.label) { + entityType = 'label_id'; + } else if (list.assignee) { + entityType = 'assignee_id'; + } else if (IS_EE && list.milestone) { + entityType = 'milestone_id'; + } + + return this.createList(entity.id, entityType) + .then(res => res.data) + .then(data => { + list.id = data.id; + list.type = data.list_type; + list.position = data.position; + list.label = data.label; + + return list.getIssues(); + }); + }, + getIssuesForList(id, filter = {}) { const data = { id }; Object.keys(filter).forEach(key => { -- cgit v1.2.3