import net.pterodactylus.sone.utils.parameters
import net.pterodactylus.sone.web.WebInterface
import net.pterodactylus.sone.web.page.FreenetRequest
import net.pterodactylus.util.template.Template
import net.pterodactylus.util.template.TemplateContext
import net.pterodactylus.sone.utils.parameters
import net.pterodactylus.sone.web.WebInterface
import net.pterodactylus.sone.web.page.FreenetRequest
import net.pterodactylus.util.template.Template
import net.pterodactylus.util.template.TemplateContext
-class KnownSonesPage(template: Template, webInterface: WebInterface):
- SoneTemplatePage("knownSones.html", template, "Page.KnownSones.Title", webInterface, false) {
+class KnownSonesPage @Inject constructor(template: Template, webInterface: WebInterface):
+ SoneTemplatePage("knownSones.html", webInterface, template, "Page.KnownSones.Title") {
override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
getCurrentSone(freenetRequest.toadletContext).let { currentSone ->
override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
getCurrentSone(freenetRequest.toadletContext).let { currentSone ->
.filterNot { freenetRequest.parameters["filter"] == "followed" && currentSone != null && !currentSone.hasFriend(it.id) }
.filterNot { freenetRequest.parameters["filter"] == "not-followed" && currentSone != null && currentSone.hasFriend(it.id) }
.filterNot { freenetRequest.parameters["filter"] == "new" && it.isKnown }
.filterNot { freenetRequest.parameters["filter"] == "followed" && currentSone != null && !currentSone.hasFriend(it.id) }
.filterNot { freenetRequest.parameters["filter"] == "not-followed" && currentSone != null && currentSone.hasFriend(it.id) }
.filterNot { freenetRequest.parameters["filter"] == "new" && it.isKnown }