Removed alert and added server side check for 10minutes
This commit is contained in:
@ -445,15 +445,20 @@ exports.commentEdit = function(req, res, next){
|
|||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
cmt = cmt.pop();
|
cmt = cmt.pop();
|
||||||
cmt.body = sanitizedBody;
|
var rightNow = Date.now();
|
||||||
cmt.commentOn = Date.now();
|
if ((rightNow - cmt.commentOn) < 600000){
|
||||||
cmt.save(function (err) {
|
cmt.body = sanitizedBody;
|
||||||
if (err) {
|
cmt.commentOn = Date.now();
|
||||||
return next(err);
|
cmt.save(function (err) {
|
||||||
}
|
if (err) {
|
||||||
res.send(true);
|
return next(err);
|
||||||
|
}
|
||||||
|
res.send(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
req.flash('errors', {
|
||||||
|
msg: 'Comment is too old to edit'
|
||||||
});
|
});
|
||||||
//commentSave(comment, Comment, res, next);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -62,7 +62,6 @@
|
|||||||
sentinel--;
|
sentinel--;
|
||||||
if (!sentinel) {
|
if (!sentinel) {
|
||||||
$('.comment-a-comment').on('click', 'a', function() {
|
$('.comment-a-comment').on('click', 'a', function() {
|
||||||
alert($(this).hasClass("edit-btn"));
|
|
||||||
var editOrComment = 'comment';
|
var editOrComment = 'comment';
|
||||||
if ($(this).hasClass("edit-btn")){
|
if ($(this).hasClass("edit-btn")){
|
||||||
editOrComment = 'edit';
|
editOrComment = 'edit';
|
||||||
|
Reference in New Issue
Block a user