commento.js: undo changes on failed vote

This commit is contained in:
Adhityaa Chandrasekar 2019-03-02 14:30:23 -05:00
parent 295318e6a6
commit a7cd8066f8

View File

@ -977,6 +977,10 @@
post(origin + "/api/comment/vote", json, function(resp) { post(origin + "/api/comment/vote", json, function(resp) {
if (!resp.success) { if (!resp.success) {
errorShow(resp.message); errorShow(resp.message);
classRemove(upvote, "upvoted");
classRemove(downvote, "downvoted");
score.innerText = scorify(parseInt(score.innerText.replace(/[^\d-.]/g, "")) - newDirection + oldDirection);
upDownOnclickSet(upvote, downvote, commentHex, oldDirection);
return; return;
} }
}); });