Merge pull request #2751 from liske/fixes/rest-card-members

REST API: fix handling of members property on card creation
This commit is contained in:
Lauri Ojansivu 2019-10-09 13:56:11 +03:00 committed by GitHub
commit 6feb35c079
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,