Browse Source

define the threshold for omitting body of DeleteCommentModal as static variable

Yuki Takei 8 years ago
parent
commit
62571809a0
1 changed files with 7 additions and 2 deletions
  1. 7 2
      resource/js/components/PageComment/DeleteCommentModal.js

+ 7 - 2
resource/js/components/PageComment/DeleteCommentModal.js

@@ -9,6 +9,11 @@ import UserPicture from '../User/UserPicture';
 
 
 export default class DeleteCommentModal extends React.Component {
 export default class DeleteCommentModal extends React.Component {
 
 
+  /*
+   * the threshold for omitting body
+   */
+  static get OMIT_BODY_THRES() { return 400 };
+
   constructor(props) {
   constructor(props) {
     super(props);
     super(props);
   }
   }
@@ -26,8 +31,8 @@ export default class DeleteCommentModal extends React.Component {
 
 
     // generate body
     // generate body
     let commentBody = comment.comment;
     let commentBody = comment.comment;
-    if (commentBody.length > 200) { // omit
-      commentBody = commentBody.substr(0,200) + '...';
+    if (commentBody.length > DeleteCommentModal.OMIT_BODY_THRES) { // omit
+      commentBody = commentBody.substr(0, DeleteCommentModal.OMIT_BODY_THRES) + '...';
     }
     }
     commentBody = ReactUtils.nl2br(commentBody);
     commentBody = ReactUtils.nl2br(commentBody);