Return an optional Sone from the current session.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / GetPostAjaxPage.java
index 96002b3..51ab3ee 100644 (file)
@@ -95,7 +95,7 @@ public class GetPostAjaxPage extends JsonPage {
         *            The currently logged in Sone (to store in the template)
         * @return The JSON representation of the post
         */
-       private JsonNode createJsonPost(FreenetRequest request, Post post, Sone currentSone) {
+       private JsonNode createJsonPost(FreenetRequest request, Post post, Optional<Sone> currentSone) {
                ObjectNode jsonPost = new ObjectNode(instance);
                jsonPost.put("id", post.getId());
                jsonPost.put("sone", post.getSone().getId());
@@ -106,7 +106,7 @@ public class GetPostAjaxPage extends JsonPage {
                templateContext.set("core", webInterface.getCore());
                templateContext.set("request", request);
                templateContext.set("post", post);
-               templateContext.set("currentSone", currentSone);
+               templateContext.set("currentSone", currentSone.orNull());
                templateContext.set("localSones", webInterface.getCore().getLocalSones());
                try {
                        postTemplate.render(templateContext, stringWriter);