From 8f76ebf972fe406efc8d79937040faeb52bcf206 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 31 Oct 2016 22:01:36 +0300 Subject: [PATCH] don't start loading again if already loading --- public/src/client/topic/replies.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/public/src/client/topic/replies.js b/public/src/client/topic/replies.js index c413e9ccea..e7357bcbd7 100644 --- a/public/src/client/topic/replies.js +++ b/public/src/client/topic/replies.js @@ -25,19 +25,17 @@ define('forum/topic/replies', ['navigator', 'components', 'forum/topic/posts'], var loading = button.children('[component="post/replies/loading"]'); var close = button.children('[component="post/replies/close"]'); - if (open.is(':not(.hidden)')) { + if (open.is(':not(.hidden)') && loading.is('.hidden')) { open.addClass('hidden'); loading.removeClass('hidden'); socket.emit('posts.getReplies', pid, function (err, data) { + loading.addClass('hidden'); if (err) { - loading.addClass('hidden'); open.removeClass('hidden'); - return app.alertError(err.message); } - loading.addClass('hidden'); close.removeClass('hidden'); posts.modifyPostsByPrivileges(data); @@ -55,6 +53,7 @@ define('forum/topic/replies', ['navigator', 'components', 'forum/topic/posts'], } else if (close.is(':not(.hidden)')) { close.addClass('hidden'); open.removeClass('hidden'); + loading.addClass('hidden'); post.find('[component="post/replies"]').slideUp('fast', function () { $(this).remove(); });