2
0
Эх сурвалжийг харах

Merge pull request #1184 from weseek/update-db-of-comment

create update function
Yuki Takei 6 жил өмнө
parent
commit
cf8a8125b3

+ 7 - 4
src/server/models/comment.js

@@ -64,11 +64,14 @@ module.exports = function(crowi) {
     }));
   };
 
-  commentSchema.statics.updateCommentsByPageId = function(comment, isMarkdown, pageId) {
-    // TODO GW-61 update new comment add return comment data
-    console.log('ここはmodel');
+  commentSchema.statics.updateCommentsByPageId = function(comment, isMarkdown, commentId) {
+    const Comment = this;
+
+    return Comment.findOneAndUpdate(
+      { _id: commentId },
+      { $set: { comment, isMarkdown } },
+    );
 
-    return pageId;
   };
 
   commentSchema.statics.removeCommentsByPageId = function(pageId) {