From dc49ee6247e041020e96c5d5be292e3f92926c4d Mon Sep 17 00:00:00 2001
From: Phil Hughes <me@iamphill.com>
Date: Tue, 11 Oct 2016 09:29:47 +0100
Subject: [PATCH] Updated to pass the board ID with the boards root to save
 conflicts with EE

---
 app/assets/javascripts/boards/boards_bundle.js.es6     |  3 ++-
 .../javascripts/boards/services/board_service.js.es6   | 10 +++++-----
 app/views/projects/boards/index.html.haml              |  3 ++-
 app/views/projects/boards/show.html.haml               |  3 ++-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/app/assets/javascripts/boards/boards_bundle.js.es6 b/app/assets/javascripts/boards/boards_bundle.js.es6
index 91c12570e09..d4f8f4b9420 100644
--- a/app/assets/javascripts/boards/boards_bundle.js.es6
+++ b/app/assets/javascripts/boards/boards_bundle.js.es6
@@ -28,12 +28,13 @@ $(() => {
       state: Store.state,
       loading: true,
       endpoint: $boardApp.dataset.endpoint,
+      boardId: $boardApp.dataset.boardId,
       disabled: $boardApp.dataset.disabled === 'true',
       issueLinkBase: $boardApp.dataset.issueLinkBase
     },
     init: Store.create.bind(Store),
     created () {
-      gl.boardService = new BoardService(this.endpoint);
+      gl.boardService = new BoardService(this.endpoint, this.boardId);
     },
     ready () {
       Store.disabled = this.disabled;
diff --git a/app/assets/javascripts/boards/services/board_service.js.es6 b/app/assets/javascripts/boards/services/board_service.js.es6
index 2b825c3949f..b9c91cbf31e 100644
--- a/app/assets/javascripts/boards/services/board_service.js.es6
+++ b/app/assets/javascripts/boards/services/board_service.js.es6
@@ -1,15 +1,15 @@
 class BoardService {
-  constructor (root) {
+  constructor (root, boardId) {
     Vue.http.options.root = root;
 
-    this.lists = Vue.resource(`${root}/lists{/id}`, {}, {
+    this.lists = Vue.resource(`${root}/${boardId}/lists{/id}`, {}, {
       generate: {
         method: 'POST',
-        url: `${root}/lists/generate.json`
+        url: `${root}/${boardId}/lists/generate.json`
       }
     });
-    this.issue = Vue.resource(`${root}/issues{/id}`, {});
-    this.issues = Vue.resource(`${root}/lists{/id}/issues`, {});
+    this.issue = Vue.resource(`${root}/${boardId}/issues{/id}`, {});
+    this.issues = Vue.resource(`${root}/${boardId}/lists{/id}/issues`, {});
 
     Vue.http.interceptors.push((request, next) => {
       request.headers['X-CSRF-Token'] = $.rails.csrfToken();
diff --git a/app/views/projects/boards/index.html.haml b/app/views/projects/boards/index.html.haml
index 7a1f0ee4428..9252bbc08c1 100644
--- a/app/views/projects/boards/index.html.haml
+++ b/app/views/projects/boards/index.html.haml
@@ -11,7 +11,8 @@
 = render 'shared/issuable/filter', type: :boards
 
 .boards-list#board-app{ "v-cloak" => true,
-  "data-endpoint" => "#{namespace_project_board_path(@project.namespace, @project, @boards.first)}",
+  "data-endpoint" => "#{namespace_project_boards_path(@project.namespace, @project)}",
+  "data-board-id" => "#{@boards.first.id}",
   "data-disabled" => "#{!can?(current_user, :admin_list, @project)}",
   "data-issue-link-base" => "#{namespace_project_issues_path(@project.namespace, @project)}" }
   .boards-app-loading.text-center{ "v-if" => "loading" }
diff --git a/app/views/projects/boards/show.html.haml b/app/views/projects/boards/show.html.haml
index 7bc476264b1..d6e1ac5f3cf 100644
--- a/app/views/projects/boards/show.html.haml
+++ b/app/views/projects/boards/show.html.haml
@@ -11,7 +11,8 @@
 = render 'shared/issuable/filter', type: :boards
 
 .boards-list#board-app{ "v-cloak" => true,
-  "data-endpoint" => "#{namespace_project_board_path(@project.namespace, @project, @board)}",
+  "data-endpoint" => "#{namespace_project_boards_path(@project.namespace, @project)}",
+  "data-board-id" => "#{@board.id}",
   "data-disabled" => "#{!can?(current_user, :admin_list, @project)}",
   "data-issue-link-base" => "#{namespace_project_issues_path(@project.namespace, @project)}" }
   .boards-app-loading.text-center{ "v-if" => "loading" }
-- 
GitLab