Remove the possibility to create Sones from the getLocalSone() method.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 27 Sep 2014 18:23:29 +0000 (20:23 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 27 Sep 2014 18:23:29 +0000 (20:23 +0200)
NOTE: the code of this commit does not compile, it’s part of a larger
commit.

12 files changed:
src/main/java/net/pterodactylus/sone/web/CreatePostPage.java
src/main/java/net/pterodactylus/sone/web/CreateReplyPage.java
src/main/java/net/pterodactylus/sone/web/LockSonePage.java
src/main/java/net/pterodactylus/sone/web/LoginPage.java
src/main/java/net/pterodactylus/sone/web/UnlockSonePage.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java
src/main/java/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.java
src/main/java/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.java
src/main/java/net/pterodactylus/sone/web/ajax/LockSoneAjaxPage.java
src/main/java/net/pterodactylus/sone/web/ajax/UnlockSoneAjaxPage.java
src/test/java/net/pterodactylus/sone/fcp/LockSoneCommandTest.java
src/test/java/net/pterodactylus/sone/fcp/UnlockSoneCommandTest.java

index 83913b4..479aee6 100644 (file)
@@ -63,7 +63,7 @@ public class CreatePostPage extends SoneTemplatePage {
                                String senderId = request.getHttpRequest().getPartAsStringFailsafe("sender", 43);
                                String recipientId = request.getHttpRequest().getPartAsStringFailsafe("recipient", 43);
                                Sone currentSone = getCurrentSone(request.getToadletContext());
-                               Sone sender = webInterface.getCore().getLocalSone(senderId, false);
+                               Sone sender = webInterface.getCore().getLocalSone(senderId);
                                if (sender == null) {
                                        sender = currentSone;
                                }
index c8979c1..55903d8 100644 (file)
@@ -66,7 +66,7 @@ public class CreateReplyPage extends SoneTemplatePage {
                        }
                        if (text.length() > 0) {
                                String senderId = request.getHttpRequest().getPartAsStringFailsafe("sender", 43);
-                               Sone sender = webInterface.getCore().getLocalSone(senderId, false);
+                               Sone sender = webInterface.getCore().getLocalSone(senderId);
                                if (sender == null) {
                                        sender = getCurrentSone(request.getToadletContext());
                                }
index 604b176..f72252f 100644 (file)
@@ -53,7 +53,7 @@ public class LockSonePage extends SoneTemplatePage {
        protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
                super.processTemplate(request, templateContext);
                String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone", 44);
-               Sone sone = webInterface.getCore().getLocalSone(soneId, false);
+               Sone sone = webInterface.getCore().getLocalSone(soneId);
                if (sone != null) {
                        webInterface.getCore().lockSone(sone);
                }
index a837bd1..a1c71b1 100644 (file)
@@ -70,7 +70,7 @@ public class LoginPage extends SoneTemplatePage {
                templateContext.set("sones", localSones);
                if (request.getMethod() == Method.POST) {
                        String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone-id", 100);
-                       Sone selectedSone = webInterface.getCore().getLocalSone(soneId, false);
+                       Sone selectedSone = webInterface.getCore().getLocalSone(soneId);
                        if (selectedSone != null) {
                                setCurrentSone(request.getToadletContext(), selectedSone);
                                String target = request.getHttpRequest().getParam("target");
index ed92246..8491163 100644 (file)
@@ -52,7 +52,7 @@ public class UnlockSonePage extends SoneTemplatePage {
        protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
                super.processTemplate(request, templateContext);
                String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone", 44);
-               Sone sone = webInterface.getCore().getLocalSone(soneId, false);
+               Sone sone = webInterface.getCore().getLocalSone(soneId);
                if (sone != null) {
                        webInterface.getCore().unlockSone(sone);
                }
index 96c76f7..dc48e45 100644 (file)
@@ -440,7 +440,7 @@ public class WebInterface {
                if (soneId == null) {
                        return null;
                }
-               return getCore().getLocalSone(soneId, false);
+               return getCore().getLocalSone(soneId);
        }
 
        /**
index 423d2df..5cb1047 100644 (file)
@@ -54,7 +54,7 @@ public class CreatePostAjaxPage extends JsonPage {
                String recipientId = request.getHttpRequest().getParam("recipient");
                Optional<Sone> recipient = webInterface.getCore().getSone(recipientId);
                String senderId = request.getHttpRequest().getParam("sender");
-               Sone sender = webInterface.getCore().getLocalSone(senderId, false);
+               Sone sender = webInterface.getCore().getLocalSone(senderId);
                if (sender == null) {
                        sender = sone;
                }
index ea2a2c2..3449dec 100644 (file)
@@ -55,7 +55,7 @@ public class CreateReplyAjaxPage extends JsonPage {
                String postId = request.getHttpRequest().getParam("post");
                String text = request.getHttpRequest().getParam("text").trim();
                String senderId = request.getHttpRequest().getParam("sender");
-               Sone sender = webInterface.getCore().getLocalSone(senderId, false);
+               Sone sender = webInterface.getCore().getLocalSone(senderId);
                if (sender == null) {
                        sender = getCurrentSone(request.getToadletContext());
                }
index 68668b7..cc04338 100644 (file)
@@ -45,7 +45,7 @@ public class LockSoneAjaxPage extends JsonPage {
        @Override
        protected JsonReturnObject createJsonObject(FreenetRequest request) {
                String soneId = request.getHttpRequest().getParam("sone");
-               Sone sone = webInterface.getCore().getLocalSone(soneId, false);
+               Sone sone = webInterface.getCore().getLocalSone(soneId);
                if (sone == null) {
                        return createErrorJsonObject("invalid-sone-id");
                }
index f92132d..3a91f81 100644 (file)
@@ -45,7 +45,7 @@ public class UnlockSoneAjaxPage extends JsonPage {
        @Override
        protected JsonReturnObject createJsonObject(FreenetRequest request) {
                String soneId = request.getHttpRequest().getParam("sone");
-               Sone sone = webInterface.getCore().getLocalSone(soneId, false);
+               Sone sone = webInterface.getCore().getLocalSone(soneId);
                if (sone == null) {
                        return createErrorJsonObject("invalid-sone-id");
                }
index ae1993a..2306931 100644 (file)
@@ -20,7 +20,6 @@ package net.pterodactylus.sone.fcp;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Matchers.anyBoolean;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -51,7 +50,7 @@ public class LockSoneCommandTest {
                when(localSone.isLocal()).thenReturn(true);
                Core core = mock(Core.class);
                when(core.getSone(eq("LocalSone"))).thenReturn(Optional.of(localSone));
-               when(core.getLocalSone(eq("LocalSone"), anyBoolean())).thenReturn(localSone);
+               when(core.getLocalSone(eq("LocalSone"))).thenReturn(localSone);
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();
 
                LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
index b966b19..ca615ee 100644 (file)
@@ -20,7 +20,6 @@ package net.pterodactylus.sone.fcp;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Matchers.anyBoolean;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -51,7 +50,7 @@ public class UnlockSoneCommandTest {
                when(localSone.isLocal()).thenReturn(true);
                Core core = mock(Core.class);
                when(core.getSone(eq("LocalSone"))).thenReturn(Optional.of(localSone));
-               when(core.getLocalSone(eq("LocalSone"), anyBoolean())).thenReturn(localSone);
+               when(core.getLocalSone(eq("LocalSone"))).thenReturn(localSone);
                SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();
 
                UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);