shinoka7 пре 6 година
родитељ
комит
22098f1245
2 измењених фајлова са 3 додато и 3 уклоњено
  1. 2 2
      src/server/models/comment.js
  2. 1 1
      src/server/routes/comment.js

+ 2 - 2
src/server/models/comment.js

@@ -78,11 +78,11 @@ module.exports = function(crowi) {
     }));
   };
 
-  commentSchema.methods.removeWithReplies = function(commentId) {
+  commentSchema.methods.removeWithReplies = function() {
     const Comment = crowi.model('Comment');
 
     return new Promise(((resolve, reject) => {
-      Comment.remove({ $or: [{ replyTo: commentId }, { _id: commentId }] }, (err, done) => {
+      Comment.remove({ $or: [{ replyTo: this._id }, { _id: this._id }] }, (err, done) => {
         if (err) {
           return reject(err);
         }

+ 1 - 1
src/server/routes/comment.js

@@ -174,7 +174,7 @@ module.exports = function(crowi, app) {
         throw new Error('Current user is not accessible to this page.');
       }
 
-      await comment.removeWithReplies(commentId);
+      await comment.removeWithReplies();
       await Page.updateCommentCount(comment.page);
     }
     catch (err) {