Add test for DI constructability of TrustAjaxPage
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / ajax / TrustAjaxPage.kt
index 228a0b5..ef806eb 100644 (file)
@@ -5,19 +5,21 @@ import net.pterodactylus.sone.utils.let
 import net.pterodactylus.sone.utils.parameters
 import net.pterodactylus.sone.web.WebInterface
 import net.pterodactylus.sone.web.page.FreenetRequest
+import javax.inject.Inject
 
 /**
  * AJAX page that lets the user trust a Sone.
  *
  * @see net.pterodactylus.sone.core.Core.trustSone
  */
-class TrustAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("trustSone.ajax", webInterface) {
+class TrustAjaxPage @Inject constructor(webInterface: WebInterface) :
+               LoggedInJsonPage("trustSone.ajax", webInterface) {
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["sone"]
-                                       .let(webInterface.core::getSone)
-                                       ?.let { webInterface.core.trustSone(currentSone, it) }
-                                       ?.let { createSuccessJsonObject().put("trustValue", webInterface.core.preferences.positiveTrust) }
+                                       ?.let(core::getSone)
+                                       ?.let { core.trustSone(currentSone, it) }
+                                       ?.let { createSuccessJsonObject().put("trustValue", core.preferences.positiveTrust) }
                                        ?: createErrorJsonObject("invalid-sone-id")
 
 }