소스 검색

When adding a user to a board that has subtasks, also add user to the subtask board

Pedro Sousa 5 년 전
부모
커밋
6ced47aa8c
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      models/users.js

+ 10 - 0
models/users.js

@@ -814,6 +814,16 @@ if (Meteor.isServer) {
       board.addMember(user._id);
       board.addMember(user._id);
       user.addInvite(boardId);
       user.addInvite(boardId);
 
 
+      //Check if there is a subtasks board
+      if (board.subtasksDefaultBoardId){
+        const subBoard = Boards.findOne(board.subtasksDefaultBoardId);
+        //If there is, also add user to that board
+        if (subBoard) {
+          subBoard.addMember(user._id);
+          user.addInvite(subBoard._id);
+        }
+      }
+      
       try {
       try {
         const params = {
         const params = {
           user: user.username,
           user: user.username,