mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
direct hook to bypass the checking step with API request
This commit is contained in:
parent
cbcf10a02b
commit
e2ee005a5f
2 changed files with 186 additions and 141 deletions
|
|
@ -56,6 +56,16 @@ CardComments.helpers({
|
|||
|
||||
CardComments.hookOptions.after.update = { fetchPrevious: false };
|
||||
|
||||
function commentCreation(userId, doc){
|
||||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'addComment',
|
||||
boardId: doc.boardId,
|
||||
cardId: doc.cardId,
|
||||
commentId: doc._id,
|
||||
});
|
||||
}
|
||||
|
||||
if (Meteor.isServer) {
|
||||
// Comments are often fetched within a card, so we create an index to make these
|
||||
// queries more efficient.
|
||||
|
|
@ -64,13 +74,7 @@ if (Meteor.isServer) {
|
|||
});
|
||||
|
||||
CardComments.after.insert((userId, doc) => {
|
||||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'addComment',
|
||||
boardId: doc.boardId,
|
||||
cardId: doc.cardId,
|
||||
commentId: doc._id,
|
||||
});
|
||||
commentCreation(userId, doc);
|
||||
});
|
||||
|
||||
CardComments.after.remove((userId, doc) => {
|
||||
|
|
@ -114,12 +118,16 @@ if (Meteor.isServer) {
|
|||
Authentication.checkUserId( req.userId);
|
||||
const paramBoardId = req.params.boardId;
|
||||
const paramCardId = req.params.cardId;
|
||||
const id = CardComments.insert({
|
||||
const id = CardComments.direct.insert({
|
||||
userId: req.body.authorId,
|
||||
text: req.body.comment,
|
||||
cardId: paramCardId,
|
||||
boardId: paramBoardId,
|
||||
});
|
||||
|
||||
const cardComment = CardComments.findOne({_id: id, cardId:paramCardId, boardId: paramBoardId });
|
||||
commentCreation(req.body.authorId, cardComment);
|
||||
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue