val postPagination = cache.get(phrases) {
soneRequest.core.sones
.flatMap(Sone::getPosts)
- .filter { Post.FUTURE_POSTS_FILTER.apply(it) }
+ .filter(noFuturePost)
.scoreAndPaginate(phrases, soneRequest.core.preferences.postsPerPage) { it.allText(soneNameCache, soneRequest.core::getReplies) }
}.apply { page = soneRequest.parameters["postPage"].emptyToNull?.toIntOrNull() ?: 0 }
private fun Post.allText(soneNameCache: (Sone) -> String, getReplies: (String) -> Collection<PostReply>) =
(text + recipient.orNull()?.let { " ${soneNameCache(it)}" } + getReplies(id)
- .filter { PostReply.FUTURE_REPLY_FILTER.apply(it) }
+ .filter(noFutureReply)
.map { "${soneNameCache(it.sone)} ${it.text}" }.joinToString(" ", " ")).toLowerCase()
private fun Iterable<Phrase>.indicesFor(text: String, predicate: (Phrase) -> Boolean) =
}
}
- private fun redirect(target: String): Nothing = throw RedirectException(target)
+ private fun redirect(target: String): Nothing = redirectTo(target)
enum class Optionality {
OPTIONAL,