From: David ‘Bombe’ Roden Date: Thu, 20 Jan 2011 06:00:12 +0000 (+0100) Subject: Store the notification in itself when rendering. X-Git-Tag: 0.4.2^2~21 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=b7d7b2d4441e1b8be0ee1cafb05c361b275971a7 Store the notification in itself when rendering. --- diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java index 71cc156..fd9ae76 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java @@ -37,6 +37,7 @@ import net.pterodactylus.util.json.JsonArray; import net.pterodactylus.util.json.JsonObject; import net.pterodactylus.util.notify.Notification; import net.pterodactylus.util.notify.TemplateNotification; +import net.pterodactylus.util.template.TemplateContext; /** * The “get status” AJAX handler returns all information that is necessary to @@ -171,7 +172,9 @@ public class GetStatusAjaxPage extends JsonPage { StringWriter notificationWriter = new StringWriter(); try { if (notification instanceof TemplateNotification) { - ((TemplateNotification) notification).render(webInterface.getTemplateContextFactory().createTemplateContext().mergeContext(((TemplateNotification) notification).getTemplateContext()), notificationWriter); + TemplateContext templateContext = webInterface.getTemplateContextFactory().createTemplateContext().mergeContext(((TemplateNotification) notification).getTemplateContext()); + templateContext.set("notification", notification); + ((TemplateNotification) notification).render(templateContext, notificationWriter); } else { notification.render(notificationWriter); }