X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetPostAjaxPage.java;h=bb1e416439940916132df3031136d282581d4e84;hb=30ef483c663ded175b66b50b652a0497e04bd493;hp=96002b3fbc4d760f93591e3980e6a37a6579ad0d;hpb=629ddb006542df2b671e172d8f544815bbab639b;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java index 96002b3..bb1e416 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.java @@ -22,8 +22,8 @@ import static com.fasterxml.jackson.databind.node.JsonNodeFactory.instance; import com.google.common.base.Optional; +import net.pterodactylus.sone.data.LocalSone; import net.pterodactylus.sone.data.Post; -import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.io.Closer; @@ -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 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);