Browse Source

Fix bug in call to get default swimlane

John R. Supplee 4 years ago
parent
commit
36a4740429
1 changed files with 7 additions and 6 deletions
  1. 7 6
      server/publications/swimlanes.js

+ 7 - 6
server/publications/swimlanes.js

@@ -4,19 +4,20 @@ Meteor.methods({
     check(toBoardId, String);
 
     const swimlane = Swimlanes.findOne(swimlaneId);
-    const board = Boards.findOne(toBoardId);
+    const fromBoard = Boards.findOne(swimlane.boardId);
+    const toBoard = Boards.findOne(toBoardId);
 
-    if (swimlane && board) {
+    if (swimlane && toBoard) {
       swimlane.lists().forEach(list => {
-        const boardList = Lists.findOne({
+        const toList = Lists.findOne({
           boardId: toBoardId,
           title: list.title,
           archived: false,
         });
 
         let toListId;
-        if (boardList) {
-          toListId = boardList._id;
+        if (toList) {
+          toListId = toList._id;
         } else {
           toListId = Lists.insert({
             title: list.title,
@@ -42,7 +43,7 @@ Meteor.methods({
       });
 
       // make sure there is a default swimlane
-      this.board().getDefaultSwimline();
+      fromBoard.getDefaultSwimline();
 
       return true;
     }