Try to prevent multiple insertion of the same replies.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 1 Dec 2010 16:23:58 +0000 (17:23 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 2 Dec 2010 19:34:02 +0000 (20:34 +0100)
src/main/resources/static/javascript/sone.js

index 69c11e0..0d1772e 100644 (file)
@@ -707,8 +707,11 @@ function loadNewReply(replyId) {
        if (replyId in loadedReplies) {
                return;
        }
-       loadedReplies[replyId] = true;
        $.getJSON("getReply.ajax", { "reply": replyId }, function(data, textStatus) {
+               if (replyId in loadedReplies) {
+                       return;
+               }
+               loadedReplies[replyId] = true;
                /* find post. */
                if ((data != null) && data.success) {
                        $("#sone .post#" + data.reply.postId).each(function() {