فهرست منبع

insert correct user data to using emit func

kaori 4 سال پیش
والد
کامیت
7b82200149
1فایلهای تغییر یافته به همراه2 افزوده شده و 3 حذف شده
  1. 2 3
      packages/app/src/server/models/comment.js

+ 2 - 3
packages/app/src/server/models/comment.js

@@ -69,15 +69,14 @@ module.exports = function(crowi) {
     const Comment = this;
     const Comment = this;
     const commentEvent = crowi.event('comment');
     const commentEvent = crowi.event('comment');
 
 
-    await commentEvent.emit('update', comment.creator);
-
     const commentData = await Comment.findOneAndUpdate(
     const commentData = await Comment.findOneAndUpdate(
       { _id: commentId },
       { _id: commentId },
       { $set: { comment, isMarkdown } },
       { $set: { comment, isMarkdown } },
     );
     );
 
 
-    return commentData;
+    await commentEvent.emit('update', commentData.creator);
 
 
+    return commentData;
   };
   };
 
 
   commentSchema.statics.removeCommentsByPageId = function(pageId) {
   commentSchema.statics.removeCommentsByPageId = function(pageId) {