From: David ‘Bombe’ Roden Date: Fri, 21 Jan 2011 10:05:16 +0000 (+0100) Subject: If there is only one local Sone, always be logged in as it. X-Git-Tag: 0.4.2^2~11 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4a19df92edd7da1b5d1b828a34c72f8e34ec738c;p=Sone.git If there is only one local Sone, always be logged in as it. --- diff --git a/src/main/java/net/pterodactylus/sone/web/LogoutPage.java b/src/main/java/net/pterodactylus/sone/web/LogoutPage.java index 23ccec0..f388368 100644 --- a/src/main/java/net/pterodactylus/sone/web/LogoutPage.java +++ b/src/main/java/net/pterodactylus/sone/web/LogoutPage.java @@ -57,7 +57,7 @@ public class LogoutPage extends SoneTemplatePage { */ @Override public boolean isEnabled(ToadletContext toadletContext) { - return getCurrentSone(toadletContext, false) != null; + return (getCurrentSone(toadletContext, false) != null) && (webInterface.getCore().getLocalSones().size() != 1); } } diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 13c7157..0df6d79 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -309,6 +309,10 @@ public class WebInterface implements CoreListener { * currently logged in */ public Sone getCurrentSone(ToadletContext toadletContext, boolean create) { + Set localSones = getCore().getLocalSones(); + if (localSones.size() == 1) { + return localSones.iterator().next(); + } return getCurrentSone(getCurrentSession(toadletContext, create)); }