|
|
@@ -19,7 +19,7 @@ module.exports = function(crowi, app) {
|
|
|
* @apiParam {String} page_id Page Id.
|
|
|
* @apiParam {String} revision_id Revision Id.
|
|
|
*/
|
|
|
- api.get = function(req, res){
|
|
|
+ api.get = function(req, res) {
|
|
|
var pageId = req.query.page_id;
|
|
|
var revisionId = req.query.revision_id;
|
|
|
|
|
|
@@ -50,7 +50,7 @@ module.exports = function(crowi, app) {
|
|
|
* @apiParam {String} comment Comment body
|
|
|
* @apiParam {Number} comment_position=-1 Line number of the comment
|
|
|
*/
|
|
|
- api.add = function(req, res){
|
|
|
+ api.add = function(req, res) {
|
|
|
var form = req.form.commentForm;
|
|
|
|
|
|
if (!req.form.isValid) {
|
|
|
@@ -62,8 +62,9 @@ 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;
|
|
|
|
|
|
- return Comment.create(pageId, req.user._id, revisionId, comment, position)
|
|
|
+ return Comment.create(pageId, req.user._id, revisionId, comment, position, isMarkdown)
|
|
|
.then(function(createdComment) {
|
|
|
createdComment.creator = req.user;
|
|
|
return res.json(ApiResponse.success({comment: createdComment}));
|
|
|
@@ -79,7 +80,7 @@ module.exports = function(crowi, app) {
|
|
|
*
|
|
|
* @apiParam {String} comment_id Comment Id.
|
|
|
*/
|
|
|
- api.remove = function(req, res){
|
|
|
+ api.remove = function(req, res) {
|
|
|
var commentId = req.body.comment_id;
|
|
|
if (!commentId) {
|
|
|
return Promise.resolve(res.json(ApiResponse.error(`'comment_id' is undefined`)));
|
|
|
@@ -92,11 +93,11 @@ module.exports = function(crowi, app) {
|
|
|
return Page.updateCommentCount(comment.page);
|
|
|
})
|
|
|
.then(function() {
|
|
|
- return res.json(ApiResponse.success({}));
|
|
|
+ return res.json(ApiResponse.success({}));
|
|
|
});
|
|
|
})
|
|
|
.catch(function(err) {
|
|
|
- return res.json(ApiResponse.error(err));
|
|
|
+ return res.json(ApiResponse.error(err));
|
|
|
});
|
|
|
|
|
|
};
|