X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FIndexPage.kt;h=5e3f9050574d9779a9b56d7685fde00ade2d19f6;hb=d3341150dde11b1d510193b71b22db85e426d6fb;hp=f44b145292fcc827750e0a3d260143907de6039e;hpb=cd72add62ab407336b471d4b7cda8e33dd2df5c6;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt index f44b145..5e3f905 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/IndexPage.kt @@ -1,21 +1,23 @@ package net.pterodactylus.sone.web.pages -import net.pterodactylus.sone.data.Sone -import net.pterodactylus.sone.notify.PostVisibilityFilter -import net.pterodactylus.sone.utils.paginate -import net.pterodactylus.sone.utils.parameters -import net.pterodactylus.sone.web.WebInterface +import net.pterodactylus.sone.data.* +import net.pterodactylus.sone.main.* +import net.pterodactylus.sone.notify.* +import net.pterodactylus.sone.utils.* +import net.pterodactylus.sone.web.* import net.pterodactylus.sone.web.page.* -import net.pterodactylus.util.template.Template -import net.pterodactylus.util.template.TemplateContext -import javax.inject.Inject +import net.pterodactylus.util.template.* +import javax.inject.* /** * The index page shows the main page of Sone. This page will contain the posts * of all friends of the current user. */ -class IndexPage @Inject constructor(template: Template, webInterface: WebInterface, private val postVisibilityFilter: PostVisibilityFilter) : - LoggedInPage("index.html", template, "Page.Index.Title", webInterface) { +@MenuName("Index") +@TemplatePath("/templates/index.html") +@ToadletPath("index.html") +class IndexPage @Inject constructor(webInterface: WebInterface, loaders: Loaders, templateRenderer: TemplateRenderer, private val postVisibilityFilter: PostVisibilityFilter) : + LoggedInPage("Page.Index.Title", webInterface, loaders, templateRenderer) { override fun handleRequest(soneRequest: SoneRequest, currentSone: Sone, templateContext: TemplateContext) { (currentSone.posts + @@ -24,7 +26,7 @@ class IndexPage @Inject constructor(template: Template, webInterface: WebInterfa .flatMap { it.posts } + soneRequest.core.getDirectedPosts(currentSone.id) ).distinct() - .filter { postVisibilityFilter.isVisible(currentSone).apply(it) } + .filter { postVisibilityFilter.isVisible(currentSone).test(it) } .sortedByDescending { it.time } .let { posts -> posts.paginate(soneRequest.core.preferences.postsPerPage)