diff --git a/client/coral-framework/store/actions/items.js b/client/coral-framework/store/actions/items.js index 2e7dca70f..25aa5d54e 100644 --- a/client/coral-framework/store/actions/items.js +++ b/client/coral-framework/store/actions/items.js @@ -248,7 +248,8 @@ export function deleteAction (item_id, action_type, user_id, item_type) { return () => { const action = { action_type, - user_id + user_id, + item_id }; return fetch(`/api/v1/${item_type}/${item_id}/actions`, getInit('DELETE', action)) diff --git a/models/comment.js b/models/comment.js index 492c06e9c..d17e98860 100644 --- a/models/comment.js +++ b/models/comment.js @@ -194,12 +194,12 @@ CommentSchema.statics.removeById = function(id) { * @param {String} action_type the type of the action to be removed * @param {String} user_id the id of the user performing the action */ -CommentSchema.statics.removeAction = function(id, user_id, action_type) { +CommentSchema.statics.removeAction = function(item_id, user_id, action_type) { return Action.remove({ - action_type: action_type, + action_type, item_type: 'comment', - item_id: id, - user_id: user_id + item_id, + user_id }); }; diff --git a/routes/api/comments/index.js b/routes/api/comments/index.js index 4954563cb..05ad75b72 100644 --- a/routes/api/comments/index.js +++ b/routes/api/comments/index.js @@ -135,9 +135,9 @@ router.delete('/:comment_id', (req, res, next) => { router.delete('/:comment_id/actions', (req, res, next) => { Comment - .removeAction(req.params.comment_id, req.body.user_id, req.body.action_type) + .removeAction(req.params.item_id, req.body.user_id, req.body.action_type) .then(() => { - res.status(201).sent({}); + res.status(201).send({}); }) .catch(error => { next(error);