Browse Source

change where to handle undefined

sou 8 years ago
parent
commit
4adad57a2f
2 changed files with 2 additions and 2 deletions
  1. 1 1
      lib/form/comment.js
  2. 1 1
      lib/routes/comment.js

+ 1 - 1
lib/form/comment.js

@@ -8,5 +8,5 @@ module.exports = form(
   field('commentForm.revision_id').trim().required(),
   field('commentForm.revision_id').trim().required(),
   field('commentForm.comment').trim().required(),
   field('commentForm.comment').trim().required(),
   field('commentForm.comment_position').trim().toInt(),
   field('commentForm.comment_position').trim().toInt(),
-  field('commentForm.is_markdown')
+  field('commentForm.is_markdown').trim().toBoolean()
 );
 );

+ 1 - 1
lib/routes/comment.js

@@ -62,7 +62,7 @@ module.exports = function(crowi, app) {
     var revisionId = form.revision_id;
     var revisionId = form.revision_id;
     var comment = form.comment;
     var comment = form.comment;
     var position = form.comment_position || -1;
     var position = form.comment_position || -1;
-    var isMarkdown = form.is_markdown || 0;
+    var isMarkdown = form.is_markdown;
 
 
     return Comment.create(pageId, req.user._id, revisionId, comment, position, isMarkdown)
     return Comment.create(pageId, req.user._id, revisionId, comment, position, isMarkdown)
       .then(function(createdComment) {
       .then(function(createdComment) {