Skip to content

Commit

Permalink
Fix issue with update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillermo Gonzalez committed Apr 2, 2024
1 parent 834b1cd commit 65a1ea7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/comment/policies/canUpdateComment.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

module.exports = async (ctx, config, { strapi }) => {
module.exports = async (ctx, config, {strapi}) => {
if (!strapi.service('api::post.post').isAdmin(ctx) && !strapi.service('api::post.post').isStaff(ctx)) {
const comment = await strapi.query('api::comment.comment').findOne({id: ctx.params.id});
const comment = await strapi.query('api::comment.comment').findOne({where: {id: ctx.args.id}, populate: ['user']});
if (comment.user.id !== ctx.state.user.id) {
console.log('Can not edit the comment');
return false;
Expand Down

0 comments on commit 65a1ea7

Please sign in to comment.