summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/boards/components/sidebar
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-07-03 16:19:29 -0500
committerPaul Slaughter <pslaughter@gitlab.com>2018-07-03 16:19:29 -0500
commit21843c2c12f8a5410addbd60014fb73283a3cc55 (patch)
treea2c8a16b378c70fe28a3edeef3e086181bbd028d /app/assets/javascripts/boards/components/sidebar
parent26998c68c936f183ead1a84e404a61160fc646f7 (diff)
downloadgitlab-ce-21843c2c12f8a5410addbd60014fb73283a3cc55.tar.gz
Port of EE refactoring to extract EE lines from boards
Diffstat (limited to 'app/assets/javascripts/boards/components/sidebar')
-rw-r--r--app/assets/javascripts/boards/components/sidebar/remove_issue.vue41
1 files changed, 30 insertions, 11 deletions
diff --git a/app/assets/javascripts/boards/components/sidebar/remove_issue.vue b/app/assets/javascripts/boards/components/sidebar/remove_issue.vue
index 55278626ffc..90d4c710daf 100644
--- a/app/assets/javascripts/boards/components/sidebar/remove_issue.vue
+++ b/app/assets/javascripts/boards/components/sidebar/remove_issue.vue
@@ -5,7 +5,7 @@
const Store = gl.issueBoards.BoardsStore;
- export default {
+ export default Vue.extend({
props: {
issue: {
type: Object,
@@ -25,19 +25,16 @@
removeIssue() {
const { issue } = this;
const lists = issue.getLists();
- const listLabelIds = lists.map(list => list.label.id);
-
- let labelIds = issue.labels.map(label => label.id).filter(id => !listLabelIds.includes(id));
- if (labelIds.length === 0) {
- labelIds = [''];
- }
+ const req = this.buildPatchRequest(issue, lists);
const data = {
- issue: {
- label_ids: labelIds,
- },
+ issue: this.seedPatchRequest(issue, req),
};
+ if (data.issue.label_ids.length === 0) {
+ data.issue.label_ids = [''];
+ }
+
// Post the remove data
Vue.http.patch(this.updateUrl, data).catch(() => {
Flash(__('Failed to remove issue from board, please try again.'));
@@ -54,8 +51,30 @@
Store.detail.issue = {};
},
+ /**
+ * Build the default patch request.
+ */
+ buildPatchRequest(issue, lists) {
+ const listLabelIds = lists.map(list => list.label.id);
+
+ const labelIds = issue.labels
+ .map(label => label.id)
+ .filter(id => !listLabelIds.includes(id));
+
+ return {
+ label_ids: labelIds,
+ };
+ },
+ /**
+ * Seed the given patch request.
+ *
+ * (This is overridden in EE)
+ */
+ seedPatchRequest(issue, req) {
+ return req;
+ },
},
- };
+ });
</script>
<template>
<div