From 099242dcaceac5f53c142e400c81dd3cf0814bc6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 10 Dec 2019 16:51:52 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=90=9B=20Fix=20new-remote-post=20handler?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../net/pterodactylus/sone/web/notification/NewRemotePostHandler.kt | 3 ++- .../sone/web/notification/NotificationHandlerModule.kt | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/notification/NewRemotePostHandler.kt b/src/main/kotlin/net/pterodactylus/sone/web/notification/NewRemotePostHandler.kt index 1127fea..0c2368a 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NewRemotePostHandler.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NewRemotePostHandler.kt @@ -22,12 +22,13 @@ import net.pterodactylus.sone.core.event.* import net.pterodactylus.sone.data.* import net.pterodactylus.sone.notify.* import net.pterodactylus.util.notify.* +import javax.inject.* /** * Handler for [NewPostFoundEvent]s that adds the new post to the “new posts” notification and * displays the notification if the “first start” notification is not being shown. */ -class NewRemotePostHandler(private val notificationManager: NotificationManager, private val notification: ListNotification) { +class NewRemotePostHandler @Inject constructor(private val notificationManager: NotificationManager, @Named("newRemotePost") private val notification: ListNotification) { @Subscribe fun newPostFound(newPostFoundEvent: NewPostFoundEvent) { 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 522e983..c75cbc1 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/notification/NotificationHandlerModule.kt @@ -39,6 +39,7 @@ class NotificationHandlerModule : AbstractModule() { bind().asSingleton() bind().asSingleton() bind().asSingleton() + bind().asSingleton() } @Provides @@ -57,11 +58,6 @@ class NotificationHandlerModule : AbstractModule() { @Provides @Singleton - fun getNewRemotePostHandler(notificationManager: NotificationManager, @Named("newRemotePost") newPostNotification: ListNotification) = - NewRemotePostHandler(notificationManager, newPostNotification) - - @Provides - @Singleton @Named("newRemotePost") fun getNewPostNotification(loaders: Loaders) = ListNotification("new-post-notification", "posts", loaders.loadTemplate("/templates/notify/newPostNotification.html"), dismissable = false) -- 2.7.4