import com.google.common.base.Optional;
+import net.pterodactylus.sone.data.LocalSone;
import net.pterodactylus.sone.data.PostReply;
-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;
* 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<LocalSone> currentSone) {
ObjectNode jsonReply = new ObjectNode(instance);
jsonReply.put("id", reply.getId());
jsonReply.put("postId", reply.getPostId());
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) {