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
* 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
)
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