X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fnotification%2FNotificationHandlerModule.kt;h=4a91fc7d9c16f6d33879cb4afab83afb101072f5;hp=96a7cdf991362215235efaf2d96dffa1d98a7bb6;hb=b5848fd116890f2b9434f169a16d203f24bfa94e;hpb=60b0b8a4b6954a0137b963397e144fd4ed82e3a8 diff --git a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt index 96a7cdf..4a91fc7 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt @@ -40,9 +40,11 @@ class NotificationHandlerModule : AbstractModule() { override fun configure() { bind(NotificationHandler::class.java).`in`(Singleton::class.java) bind().asSingleton() + bind().asSingleton() bind().asSingleton() bind().asSingleton() bind().asSingleton() + bind().asSingleton() bind().asSingleton() bind().asSingleton() bind().asSingleton() @@ -52,12 +54,16 @@ class NotificationHandlerModule : AbstractModule() { bind().asSingleton() bind().asSingleton() bind().asSingleton() + bind().asSingleton() } @Provides fun getMarkPostKnownHandler(core: Core): Consumer = Consumer { core.markPostKnown(it) } @Provides + fun getMarkPostReplyKnownHandler(core: Core): Consumer = Consumer { core.markReplyKnown(it) } + + @Provides @Singleton @Named("soneLockedOnStartup") fun getSoneLockedOnStartupNotification(loaders: Loaders) = @@ -76,6 +82,12 @@ class NotificationHandlerModule : AbstractModule() { @Provides @Singleton + @Named("newRemotePostReply") + fun getNewRemotePostReplyNotification(loaders: Loaders) = + ListNotification("new-reply-notification", "replies", loaders.loadTemplate("/templates/notify/newReplyNotification.html"), dismissable = false) + + @Provides + @Singleton @Named("soneLocked") fun getSoneLockedNotification(loaders: Loaders) = ListNotification("sones-locked-notification", "sones", loaders.loadTemplate("/templates/notify/lockedSonesNotification.html"), dismissable = true) @@ -146,6 +158,12 @@ class NotificationHandlerModule : AbstractModule() { fun getWebOfTrustReschedule(@Named("notification") ticker: ScheduledExecutorService) = Consumer { ticker.schedule(it, 15, SECONDS) } + @Provides + @Singleton + @Named("soneMentioned") + fun getSoneMentionedNotification(loaders: Loaders) = + ListNotification("mention-notification", "posts", loaders.loadTemplate("/templates/notify/mentionNotification.html"), dismissable = false) + private inline fun bind(): AnnotatedBindingBuilder = bind(T::class.java) private fun ScopedBindingBuilder.asSingleton() = `in`(Singleton::class.java)