Removed alert and added server side check for 10minutes

This commit is contained in:
MrRenter
2015-04-18 02:46:16 -04:00
parent 349dbbc2af
commit 790a4f941d
2 changed files with 13 additions and 9 deletions

View File

@ -445,15 +445,20 @@ exports.commentEdit = function(req, res, next){
return next(err);
}
cmt = cmt.pop();
cmt.body = sanitizedBody;
cmt.commentOn = Date.now();
cmt.save(function (err) {
if (err) {
return next(err);
}
res.send(true);
var rightNow = Date.now();
if ((rightNow - cmt.commentOn) < 600000){
cmt.body = sanitizedBody;
cmt.commentOn = Date.now();
cmt.save(function (err) {
if (err) {
return next(err);
}
res.send(true);
});
}
req.flash('errors', {
msg: 'Comment is too old to edit'
});
//commentSave(comment, Comment, res, next);
});
};

View File

@ -62,7 +62,6 @@
sentinel--;
if (!sentinel) {
$('.comment-a-comment').on('click', 'a', function() {
alert($(this).hasClass("edit-btn"));
var editOrComment = 'comment';
if ($(this).hasClass("edit-btn")){
editOrComment = 'edit';