Make option to enable Sone insert notifications editable.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / OptionsPage.java
index 3d1eaad..fda6afd 100644 (file)
@@ -64,7 +64,9 @@ public class OptionsPage extends SoneTemplatePage {
                        if (currentSone != null) {
                                boolean autoFollow = request.getHttpRequest().isPartSet("auto-follow");
                                currentSone.getOptions().getBooleanOption("AutoFollow").set(autoFollow);
-                               webInterface.getCore().saveSone(currentSone);
+                               boolean enableSoneInsertNotifications = request.getHttpRequest().isPartSet("enable-sone-insert-notifications");
+                               currentSone.getOptions().getBooleanOption("EnableSoneInsertNotifications").set(enableSoneInsertNotifications);
+                               webInterface.getCore().touchConfiguration();
                        }
                        Integer insertionDelay = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16));
                        if (!preferences.validateInsertionDelay(insertionDelay)) {
@@ -112,7 +114,7 @@ public class OptionsPage extends SoneTemplatePage {
                        preferences.setClearOnNextRestart(clearOnNextRestart);
                        boolean reallyClearOnNextRestart = Boolean.parseBoolean(request.getHttpRequest().getPartAsStringFailsafe("really-clear-on-next-restart", 5));
                        preferences.setReallyClearOnNextRestart(reallyClearOnNextRestart);
-                       webInterface.getCore().saveConfiguration();
+                       webInterface.getCore().touchConfiguration();
                        if (fieldErrors.isEmpty()) {
                                throw new RedirectException(getPath());
                        }
@@ -120,6 +122,7 @@ public class OptionsPage extends SoneTemplatePage {
                }
                if (currentSone != null) {
                        templateContext.set("auto-follow", currentSone.getOptions().getBooleanOption("AutoFollow").get());
+                       templateContext.set("enable-sone-insert-notifications", currentSone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get());
                }
                templateContext.set("insertion-delay", preferences.getInsertionDelay());
                templateContext.set("posts-per-page", preferences.getPostsPerPage());