فهرست منبع

Merge branch 'Re-edit-comment-for-master-merge' into create-api-for-re-edit

itizawa 6 سال پیش
والد
کامیت
5bde631574
2فایلهای تغییر یافته به همراه3 افزوده شده و 11 حذف شده
  1. 1 2
      src/client/js/components/PageComment/Comment.jsx
  2. 2 9
      src/client/js/components/PageComment/CommentEditor.jsx

+ 1 - 2
src/client/js/components/PageComment/Comment.jsx

@@ -261,9 +261,8 @@ class Comment extends React.Component {
         {showReEditor ? (
         {showReEditor ? (
           <CommentEditor
           <CommentEditor
             growiRenderer={this.growiRenderer}
             growiRenderer={this.growiRenderer}
-            currentComment={comment}
+            currentCommentId={commentId}
             commentBody={comment.comment}
             commentBody={comment.comment}
-            reEdit
             replyTo={undefined}
             replyTo={undefined}
             commentButtonClickedHandler={this.commentButtonClickedHandler}
             commentButtonClickedHandler={this.commentButtonClickedHandler}
           />
           />

+ 2 - 9
src/client/js/components/PageComment/CommentEditor.jsx

@@ -84,13 +84,7 @@ class CommentEditor extends React.Component {
   }
   }
 
 
   toggleEditor() {
   toggleEditor() {
-    let targetId;
-    if (this.props.reEdit) {
-      targetId = this.props.currentComment._id;
-    }
-    else {
-      targetId = this.props.replyTo;
-    }
+    const targetId = this.props.replyTo || this.props.currentCommentId;
     this.props.commentButtonClickedHandler(targetId);
     this.props.commentButtonClickedHandler(targetId);
   }
   }
 
 
@@ -337,8 +331,7 @@ CommentEditor.propTypes = {
 
 
   growiRenderer: PropTypes.instanceOf(GrowiRenderer).isRequired,
   growiRenderer: PropTypes.instanceOf(GrowiRenderer).isRequired,
   replyTo: PropTypes.string,
   replyTo: PropTypes.string,
-  reEdit: PropTypes.bool,
-  currentComment: PropTypes.object,
+  currentCommentId: PropTypes.string,
   commentBody: PropTypes.string,
   commentBody: PropTypes.string,
   commentButtonClickedHandler: PropTypes.func.isRequired,
   commentButtonClickedHandler: PropTypes.func.isRequired,
 };
 };