From: David ‘Bombe’ Roden Date: Thu, 30 Dec 2010 20:39:40 +0000 (+0100) Subject: Merge branch 'next' into edit-wot-trust X-Git-Tag: 0.4^2~8^2~38 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=4a2fdf3b0b3dfcfc761c83797018237ec4c82a4b;hp=a211a3bd360593efc9e7fba33d607a3b14d0a965 Merge branch 'next' into edit-wot-trust --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 9b4828c..f7b56a1 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -88,6 +88,9 @@ public class Core implements IdentityListener { /** The configuration. */ private Configuration configuration; + /** Whether we’re currently saving the configuration. */ + private boolean storingConfiguration = false; + /** The identity manager. */ private final IdentityManager identityManager; @@ -1468,7 +1471,15 @@ public class Core implements IdentityListener { /** * Saves the current options. */ - public synchronized void saveConfiguration() { + public void saveConfiguration() { + synchronized (configuration) { + if (storingConfiguration) { + logger.log(Level.FINE, "Already storing configuration…"); + return; + } + storingConfiguration = true; + } + /* store the options first. */ try { configuration.getIntValue("Option/InsertionDelay").setValue(options.getIntegerOption("InsertionDelay").getReal()); @@ -1508,6 +1519,10 @@ public class Core implements IdentityListener { } catch (ConfigurationException ce1) { logger.log(Level.SEVERE, "Could not store configuration!", ce1); + } finally { + synchronized (configuration) { + storingConfiguration = false; + } } } diff --git a/src/main/java/net/pterodactylus/sone/web/IndexPage.java b/src/main/java/net/pterodactylus/sone/web/IndexPage.java index 7562526..a33072f 100644 --- a/src/main/java/net/pterodactylus/sone/web/IndexPage.java +++ b/src/main/java/net/pterodactylus/sone/web/IndexPage.java @@ -54,15 +54,22 @@ public class IndexPage extends SoneTemplatePage { @Override protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); - Sone sone = getCurrentSone(request.getToadletContext()); + Sone currentSone = getCurrentSone(request.getToadletContext()); List allPosts = new ArrayList(); - allPosts.addAll(sone.getPosts()); - for (String friendSoneId : sone.getFriends()) { + allPosts.addAll(currentSone.getPosts()); + for (String friendSoneId : currentSone.getFriends()) { if (!webInterface.getCore().hasSone(friendSoneId)) { continue; } allPosts.addAll(webInterface.getCore().getSone(friendSoneId).getPosts()); } + for (Sone sone : webInterface.getCore().getSones()) { + for (Post post : sone.getPosts()) { + if (currentSone.equals(post.getRecipient()) && !allPosts.contains(post)) { + allPosts.add(post); + } + } + } Collections.sort(allPosts, Post.TIME_COMPARATOR); template.set("posts", allPosts); } diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index acb1d46..898c3c0 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -823,6 +823,9 @@ $(document).ready(function() { getTranslation("WebInterface.DefaultText.StatusUpdate", function(defaultText) { registerInputTextareaSwap("#sone #update-status .status-input", defaultText, "text", false, false); $("#sone #update-status").submit(function() { + if ($(this).find(":input").hasClass("default")) { + return false; + } text = $(this).find(":input:enabled").val(); $.getJSON("createPost.ajax", { "formPassword": getFormPassword(), "text": text }, function(data, textStatus) { if ((data != null) && data.success) {