♻️ Use handler for sone-mentioned notifications
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / notification / NotificationHandlerModule.kt
index 96a7cdf..cfe5db3 100644 (file)
@@ -52,6 +52,7 @@ class NotificationHandlerModule : AbstractModule() {
                bind<StartupHandler>().asSingleton()
                bind<WebOfTrustHandler>().asSingleton()
                bind<SoneMentionDetector>().asSingleton()
+               bind<SoneMentionedHandler>().asSingleton()
        }
 
        @Provides
@@ -146,6 +147,12 @@ class NotificationHandlerModule : AbstractModule() {
        fun getWebOfTrustReschedule(@Named("notification") ticker: ScheduledExecutorService) =
                        Consumer<Runnable> { ticker.schedule(it, 15, SECONDS) }
 
+       @Provides
+       @Singleton
+       @Named("soneMentioned")
+       fun getSoneMentionedNotification(loaders: Loaders) =
+                       ListNotification<Post>("mention-notification", "posts", loaders.loadTemplate("/templates/notify/mentionNotification.html"), dismissable = false)
+
        private inline fun <reified T> bind(): AnnotatedBindingBuilder<T> = bind(T::class.java)
        private fun ScopedBindingBuilder.asSingleton() = `in`(Singleton::class.java)