From cd13fe03bf2905915b3043af19480594c88e3f16 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 7 Apr 2011 11:51:44 +0200 Subject: [PATCH] Mark own posts as new to allow retrieval and insertion on all open tabs. --- src/main/java/net/pterodactylus/sone/core/Core.java | 6 ++++-- src/main/resources/static/javascript/sone.js | 9 +-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index ad1b1aa..9fe4a28 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1470,7 +1470,8 @@ public class Core implements IdentityListener, UpdateListener { posts.put(post.getId(), post); } synchronized (newPosts) { - knownPosts.add(post.getId()); + newPosts.add(post.getId()); + coreListenerManager.fireNewPostFound(post); } sone.addPost(post); saveSone(sone); @@ -1594,7 +1595,8 @@ public class Core implements IdentityListener, UpdateListener { replies.put(reply.getId(), reply); } synchronized (newReplies) { - knownReplies.add(reply.getId()); + newReplies.add(reply.getId()); + coreListenerManager.fireNewReplyFound(reply); } sone.addReply(reply); saveSone(sone); diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 21f6803..f167d69 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1558,9 +1558,6 @@ $(document).ready(function() { sender = $(this).find(":input[name=sender]").val(); text = $(this).find(":input[name=text]:enabled").val(); $.getJSON("createPost.ajax", { "formPassword": getFormPassword(), "sender": sender, "text": text }, function(data, textStatus) { - if ((data != null) && data.success) { - loadNewPost(data.postId, data.sone, data.recipient); - } button.removeAttr("disabled"); }); $(this).find(":input[name=sender]").val(getCurrentSoneId()); @@ -1589,11 +1586,7 @@ $(document).ready(function() { $("#sone #post-message").submit(function() { sender = $(this).find(":input[name=sender]").val(); text = $(this).find(":input[name=text]:enabled").val(); - $.getJSON("createPost.ajax", { "formPassword": getFormPassword(), "recipient": getShownSoneId(), "sender": sender, "text": text }, function(data, textStatus) { - if ((data != null) && data.success) { - loadNewPost(data.postId, getCurrentSoneId()); - } - }); + $.getJSON("createPost.ajax", { "formPassword": getFormPassword(), "recipient": getShownSoneId(), "sender": sender, "text": text }); $(this).find(":input[name=sender]").val(getCurrentSoneId()); $(this).find(":input[name=text]:enabled").val("").blur(); $(this).find(".sender").hide(); -- 2.7.4