Return an optional Sone from the current session.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / ajax / GetReplyAjaxPage.java
index 251c784..d0b79ac 100644 (file)
@@ -97,7 +97,7 @@ public class GetReplyAjaxPage extends JsonPage {
         *            The currently logged in Sone (to store in the template)
         * @return The JSON representation of the reply
         */
-       private JsonNode createJsonReply(FreenetRequest request, PostReply reply, Sone currentSone) {
+       private JsonNode createJsonReply(FreenetRequest request, PostReply reply, Optional<Sone> currentSone) {
                ObjectNode jsonReply = new ObjectNode(instance);
                jsonReply.put("id", reply.getId());
                jsonReply.put("postId", reply.getPostId());
@@ -108,7 +108,7 @@ public class GetReplyAjaxPage extends JsonPage {
                templateContext.set("core", webInterface.getCore());
                templateContext.set("request", request);
                templateContext.set("reply", reply);
-               templateContext.set("currentSone", currentSone);
+               templateContext.set("currentSone", currentSone.orNull());
                try {
                        replyTemplate.render(templateContext, stringWriter);
                } catch (TemplateException te1) {