Merge pull request #1854 from aignatov-bio/ai-sci-3586-comment-counter-not-updated

Fix comments counter for zero comments [SCI-3586]
This commit is contained in:
aignatov-bio 2019-06-24 09:39:22 +02:00 committed by GitHub
commit 81c76fb112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,8 +2,14 @@
/* eslint-disable no-restricted-globals, no-alert */
var Comments = (function() {
function changeCounter(comment, value) {
var currnetCount = $('#comment-counter-' + comment.closest('.comments-container').attr('data-object-id'));
currnetCount.html(parseInt(currnetCount.html(), 10) + value);
var currentCount = $('#comment-counter-' + comment.closest('.comments-container').attr('data-object-id'));
var newValue = parseInt(currentCount.html(), 10) + value;
currentCount.html(newValue);
if (newValue === 0) {
currentCount.addClass('hidden');
} else {
currentCount.removeClass('hidden');
}
}
function scrollBottom(container) {