itizawa пре 6 година
родитељ
комит
5d055cc096
2 измењених фајлова са 3 додато и 3 уклоњено
  1. 1 1
      src/client/js/services/CommentContainer.js
  2. 2 2
      src/server/routes/comment.js

+ 1 - 1
src/client/js/services/CommentContainer.js

@@ -113,7 +113,7 @@ export default class CommentContainer extends Container {
         revision_id: revisionId,
         is_markdown: isMarkdown,
         comment_id: commentId,
-        creator_id: creatorId,
+        author: this.appContainer.me,
       },
     })
       .then((res) => {

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

@@ -161,7 +161,7 @@ module.exports = function(crowi, app) {
     const comment = commentForm.comment;
     const isMarkdown = commentForm.is_markdown;
     const commentId = commentForm.comment_id;
-    const creatorId = commentForm.creator_id;
+    const author = commentForm.author;
 
     if (comment === '') {
       return res.json(ApiResponse.error('Comment text is required'));
@@ -171,7 +171,7 @@ module.exports = function(crowi, app) {
       return res.json(ApiResponse.error('\'comment_id\' is undefined'));
     }
 
-    if (creatorId !== req.user.id) {
+    if (author !== req.user.username) {
       return res.json(ApiResponse.error('Only the author can edit'));
     }