Fixes broken add_board_member API call and fixes return value for remove_board_member.

This commit is contained in:
Gustav Engström 2023-04-05 22:10:11 +02:00
parent cfd283e7e3
commit 7d69bd5c46

View file

@ -2256,9 +2256,11 @@ if (Meteor.isServer) {
* *
* @param {string} boardId the board ID * @param {string} boardId the board ID
* @param {string} userId the user ID * @param {string} userId the user ID
* @param {string} action the action (needs to be `add`)
* @param {boolean} isAdmin is the user an admin of the board * @param {boolean} isAdmin is the user an admin of the board
* @param {boolean} isNoComments disable comments * @param {boolean} isNoComments disable comments
* @param {boolean} isCommentOnly only enable comments * @param {boolean} isCommentOnly only enable comments
* @param {boolean} isWorker is the user a board worker
* @return_type {_id: string, * @return_type {_id: string,
* title: string} * title: string}
*/ */
@ -2271,7 +2273,7 @@ if (Meteor.isServer) {
const userId = req.params.userId; const userId = req.params.userId;
const boardId = req.params.boardId; const boardId = req.params.boardId;
const action = req.body.action; const action = req.body.action;
const { isAdmin, isNoComments, isCommentOnly } = req.body; const { isAdmin, isNoComments, isCommentOnly, isWorker } = req.body;
let data = Meteor.users.findOne({ let data = Meteor.users.findOne({
_id: userId, _id: userId,
}); });
@ -2291,6 +2293,7 @@ if (Meteor.isServer) {
isTrue(isAdmin), isTrue(isAdmin),
isTrue(isNoComments), isTrue(isNoComments),
isTrue(isCommentOnly), isTrue(isCommentOnly),
isTrue(isWorker),
userId, userId,
); );
} }
@ -2301,10 +2304,7 @@ if (Meteor.isServer) {
}); });
} }
} }
JsonRoutes.sendResult(res, { JsonRoutes.sendResult(res, { code: 200, data });
code: 200,
data: query,
});
} catch (error) { } catch (error) {
JsonRoutes.sendResult(res, { JsonRoutes.sendResult(res, {
code: 200, code: 200,
@ -2355,10 +2355,7 @@ if (Meteor.isServer) {
}); });
} }
} }
JsonRoutes.sendResult(res, { JsonRoutes.sendResult(res, { code: 200, data });
code: 200,
data: query,
});
} catch (error) { } catch (error) {
JsonRoutes.sendResult(res, { JsonRoutes.sendResult(res, {
code: 200, code: 200,