X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FOptionsPage.java;h=7cf72468de883295c509e325c908547a2daf9319;hp=0bc44d5000c000e9cb60e6cb758a050e856b2106;hb=9acbc5bdec4ccb752e0856a501568b0bb6161579;hpb=3d6cffe82270a1faacf1f0d39c34b11ab316e0db diff --git a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java index 0bc44d5..7cf7246 100644 --- a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java +++ b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java @@ -24,7 +24,7 @@ import java.util.List; import net.pterodactylus.sone.core.Preferences; import net.pterodactylus.sone.data.Sone; -import net.pterodactylus.sone.data.Sone.ShowCustomAvatars; +import net.pterodactylus.sone.data.SoneOptions.LoadExternalContent; import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired; import net.pterodactylus.sone.web.page.FreenetRequest; import net.pterodactylus.util.template.Template; @@ -58,10 +58,9 @@ public class OptionsPage extends SoneTemplatePage { * {@inheritDoc} */ @Override - protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException { - super.processTemplate(request, templateContext); + protected void handleRequest(FreenetRequest request, TemplateContext templateContext) throws RedirectException { Preferences preferences = webInterface.getCore().getPreferences(); - Sone currentSone = webInterface.getCurrentSone(request.getToadletContext(), false); + Sone currentSone = webInterface.getCurrentSoneWithoutCreatingSession(request.getToadletContext()); if (request.getMethod() == Method.POST) { List fieldErrors = new ArrayList(); if (currentSone != null) { @@ -76,7 +75,9 @@ public class OptionsPage extends SoneTemplatePage { boolean showNotificationNewReplies = request.getHttpRequest().isPartSet("show-notification-new-replies"); currentSone.getOptions().setShowNewReplyNotifications(showNotificationNewReplies); String showCustomAvatars = request.getHttpRequest().getPartAsStringFailsafe("show-custom-avatars", 32); - currentSone.getOptions().setShowCustomAvatars(ShowCustomAvatars.valueOf(showCustomAvatars)); + currentSone.getOptions().setShowCustomAvatars(LoadExternalContent.valueOf(showCustomAvatars)); + String loadLinkedImages = request.getHttpRequest().getPartAsStringFailsafe("load-linked-images", 32); + currentSone.getOptions().setLoadLinkedImages(LoadExternalContent.valueOf(loadLinkedImages)); webInterface.getCore().touchConfiguration(); } Integer insertionDelay = parseInt(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16), null); @@ -146,6 +147,7 @@ public class OptionsPage extends SoneTemplatePage { templateContext.set("show-notification-new-posts", currentSone.getOptions().isShowNewPostNotifications()); templateContext.set("show-notification-new-replies", currentSone.getOptions().isShowNewReplyNotifications()); templateContext.set("show-custom-avatars", currentSone.getOptions().getShowCustomAvatars().name()); + templateContext.set("load-linked-images", currentSone.getOptions().getLoadLinkedImages().name()); } templateContext.set("insertion-delay", preferences.getInsertionDelay()); templateContext.set("posts-per-page", preferences.getPostsPerPage());