Procházet zdrojové kódy

Models: Remove board from starred list

This will fix the starred counter. If the board is not public, the user
is unable to see the board and remove it from the list of starred
boards.
Alexander Sulfrian před 9 roky
rodič
revize
4013184801
1 změnil soubory, kde provedl 12 přidání a 0 odebrání
  1. 12 0
      models/boards.js

+ 12 - 0
models/boards.js

@@ -494,6 +494,18 @@ if (Meteor.isServer) {
 
 
         const board = Boards._transform(doc);
         const board = Boards._transform(doc);
         board.setWatcher(memberId, false);
         board.setWatcher(memberId, false);
+
+        // Remove board from users starred list
+        if (!board.isPublic()) {
+          Users.update(
+            memberId,
+            {
+              $pull: {
+                'profile.starredBoards': boardId,
+              },
+            }
+          );
+        }
       });
       });
     }
     }
   });
   });