Procházet zdrojové kódy

REST API: fix handling of members property on card creation

Thomas Liske před 5 roky
rodič
revize
ea90ce8784
1 změnil soubory, kde provedl 8 přidání a 1 odebrání
  1. 8 1
      models/cards.js

+ 8 - 1
models/cards.js

@@ -1852,8 +1852,15 @@ if (Meteor.isServer) {
     const check = Users.findOne({
       _id: req.body.authorId,
     });
-    const members = req.body.members || [req.body.authorId];
     if (typeof check !== 'undefined') {
+      let members = req.body.members || [];
+      if (_.isString(members)) {
+        if (members === '') {
+          members = [];
+        } else {
+          members = [members];
+        }
+      }
       const id = Cards.direct.insert({
         title: req.body.title,
         boardId: paramBoardId,