From: David ‘Bombe’ Roden Date: Thu, 14 Sep 2017 15:57:18 +0000 (+0200) Subject: Don’t send request to node if there are no posts or replies to get the times for X-Git-Tag: 0.9.7^2~62 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=648e6f419534c315ade5a506e8ec8820872ee7c8;p=Sone.git Don’t send request to node if there are no posts or replies to get the times for --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index b3f5c83..84be0d4 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1646,13 +1646,15 @@ function updatePostTime(postId, timeText, refreshTime, tooltip) { * Comma-separated post IDs */ function updatePostTimes(postIds) { - ajaxGet("getTimes.ajax", { "posts" : postIds }, function(data, textStatus) { - if ((data != null) && data.success) { - $.each(data.postTimes, function(index, value) { - updatePostTime(index, value.timeText, value.refreshTime, value.tooltip); - }); - } - }); + if (postIds != "") { + ajaxGet("getTimes.ajax", {"posts": postIds}, function (data, textStatus) { + if ((data != null) && data.success) { + $.each(data.postTimes, function (index, value) { + updatePostTime(index, value.timeText, value.refreshTime, value.tooltip); + }); + } + }); + } } /** @@ -1683,13 +1685,15 @@ function updateReplyTime(replyId, timeText, refreshTime, tooltip) { * Comma-separated post IDs */ function updateReplyTimes(replyIds) { - ajaxGet("getTimes.ajax", { "replies" : replyIds }, function(data, textStatus) { - if ((data != null) && data.success) { - $.each(data.replyTimes, function(index, value) { - updateReplyTime(index, value.timeText, value.refreshTime, value.tooltip); - }); - } - }); + if (replyIds != "") { + ajaxGet("getTimes.ajax", {"replies": replyIds}, function (data, textStatus) { + if ((data != null) && data.success) { + $.each(data.replyTimes, function (index, value) { + updateReplyTime(index, value.timeText, value.refreshTime, value.tooltip); + }); + } + }); + } } function resetActivity() {