X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetNotificationsAjaxPage.kt;h=adf3e26b8ed6218136eae7011c6ce3bb12c528f6;hp=c60fe567bf8c7bd68a1f3f270b3cf5c27511868c;hb=bf509980d5097e67d1a32f6b53bef052b396137f;hpb=fe880bd95f2f1bb155e890a9ffd2dc2abc86cb37 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.kt index c60fe56..adf3e26 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.kt @@ -8,6 +8,7 @@ import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.* import net.pterodactylus.util.notify.Notification import net.pterodactylus.util.notify.TemplateNotification +import net.pterodactylus.util.template.TemplateContextFactory import java.io.StringWriter import javax.inject.Inject @@ -15,7 +16,7 @@ import javax.inject.Inject * AJAX handler to return all current notifications. */ @ToadletPath("getNotifications.ajax") -class GetNotificationsAjaxPage @Inject constructor(webInterface: WebInterface) : JsonPage(webInterface) { +class GetNotificationsAjaxPage @Inject constructor(webInterface: WebInterface, private val templateContextFactory: TemplateContextFactory) : JsonPage(webInterface) { override val needsFormPassword = false override val requiresLogin = false @@ -46,7 +47,7 @@ class GetNotificationsAjaxPage @Inject constructor(webInterface: WebInterface) : ) private fun TemplateNotification.render(currentSone: Sone?, freenetRequest: FreenetRequest) = StringWriter().use { - val mergedTemplateContext = webInterface.templateContextFactory.createTemplateContext() + val mergedTemplateContext = templateContextFactory.createTemplateContext() .mergeContext(templateContext) .apply { this["core"] = core