X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterface.java;h=054ed533ffcead2e26cd71771510df3c1e3ab54a;hb=1c9f64a1a1aa8098596cc4c092d1074b52f63b60;hp=06da982513a0d198ccaf9779033a3f9bb2b22766;hpb=89ab5e83e3fa9afb983093ac4ab8445f83348ea3;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 06da982..054ed53 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -178,12 +178,6 @@ public class WebInterface implements CoreListener { /** The “you have been mentioned” notification. */ private final ListNotification mentionNotification; - /** The “rescuing Sone” notification. */ - private final ListNotification rescuingSonesNotification; - - /** The “Sone rescued” notification. */ - private final ListNotification sonesRescuedNotification; - /** Notifications for sone inserts. */ private final Map soneInsertNotifications = new HashMap(); @@ -258,12 +252,6 @@ public class WebInterface implements CoreListener { Template mentionNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/mentionNotification.html")); mentionNotification = new ListNotification("mention-notification", "posts", mentionNotificationTemplate, false); - Template rescuingSonesTemplate = TemplateParser.parse(createReader("/templates/notify/rescuingSonesNotification.html")); - rescuingSonesNotification = new ListNotification("sones-being-rescued-notification", "sones", rescuingSonesTemplate); - - Template sonesRescuedTemplate = TemplateParser.parse(createReader("/templates/notify/sonesRescuedNotification.html")); - sonesRescuedNotification = new ListNotification("sones-rescued-notification", "sones", sonesRescuedTemplate); - Template lockedSonesTemplate = TemplateParser.parse(createReader("/templates/notify/lockedSonesNotification.html")); lockedSonesNotification = new ListNotification("sones-locked-notification", "sones", lockedSonesTemplate); @@ -724,7 +712,7 @@ public class WebInterface implements CoreListener { TemplateNotification templateNotification = soneInsertNotifications.get(sone); if (templateNotification == null) { templateNotification = new TemplateNotification(TemplateParser.parse(createReader("/templates/notify/soneInsertNotification.html"))); - templateNotification.set("sone", sone); + templateNotification.set("insertSone", sone); soneInsertNotifications.put(sone, templateNotification); } return templateNotification; @@ -739,25 +727,6 @@ public class WebInterface implements CoreListener { * {@inheritDoc} */ @Override - public void rescuingSone(Sone sone) { - rescuingSonesNotification.add(sone); - notificationManager.addNotification(rescuingSonesNotification); - } - - /** - * {@inheritDoc} - */ - @Override - public void rescuedSone(Sone sone) { - rescuingSonesNotification.remove(sone); - sonesRescuedNotification.add(sone); - notificationManager.addNotification(sonesRescuedNotification); - } - - /** - * {@inheritDoc} - */ - @Override public void newSoneFound(Sone sone) { newSoneNotification.add(sone); if (!hasFirstStartNotification()) { @@ -897,7 +866,9 @@ public class WebInterface implements CoreListener { public void soneInserting(Sone sone) { TemplateNotification soneInsertNotification = getSoneInsertNotification(sone); soneInsertNotification.set("soneStatus", "inserting"); - notificationManager.addNotification(soneInsertNotification); + if (sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) { + notificationManager.addNotification(soneInsertNotification); + } } /** @@ -908,7 +879,9 @@ public class WebInterface implements CoreListener { TemplateNotification soneInsertNotification = getSoneInsertNotification(sone); soneInsertNotification.set("soneStatus", "inserted"); soneInsertNotification.set("insertDuration", insertDuration / 1000); - notificationManager.addNotification(soneInsertNotification); + if (sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) { + notificationManager.addNotification(soneInsertNotification); + } } /** @@ -916,7 +889,12 @@ public class WebInterface implements CoreListener { */ @Override public void soneInsertAborted(Sone sone, Throwable cause) { - notificationManager.addNotification(getSoneInsertNotification(sone).set("soneStatus", "insert-aborted").set("insert-error", cause)); + TemplateNotification soneInsertNotification = getSoneInsertNotification(sone); + soneInsertNotification.set("soneStatus", "insert-aborted"); + soneInsertNotification.set("insert-error", cause); + if (sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) { + notificationManager.addNotification(soneInsertNotification); + } } /**