Просмотр исходного кода

change where to handle undefined

sou 8 лет назад
Родитель
Сommit
4adad57a2f
2 измененных файлов с 2 добавлено и 2 удалено
  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.comment').trim().required(),
   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 comment = form.comment;
     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)
       .then(function(createdComment) {