From: Lanius Trolling Date: Tue, 14 Mar 2023 19:01:51 +0000 (-0400) Subject: Filter out shadowbanned comments X-Git-Url: https://gitweb.starshipfights.net/?a=commitdiff_plain;h=9e05fd98bca64500d3fc0e532a994121f55724e6;p=factbooks Filter out shadowbanned comments --- diff --git a/src/main/kotlin/info/mechyrdia/data/views_comment.kt b/src/main/kotlin/info/mechyrdia/data/views_comment.kt index 896e96f..97536a7 100644 --- a/src/main/kotlin/info/mechyrdia/data/views_comment.kt +++ b/src/main/kotlin/info/mechyrdia/data/views_comment.kt @@ -9,11 +9,11 @@ import info.mechyrdia.lore.* import io.ktor.http.* import io.ktor.server.application.* import io.ktor.server.util.* +import kotlinx.coroutines.flow.filterNot import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.toList import kotlinx.html.* import org.litote.kmongo.descending -import java.lang.NullPointerException import java.time.Instant suspend fun ApplicationCall.recentCommentsPage(): HTML.() -> Unit { @@ -34,6 +34,9 @@ suspend fun ApplicationCall.recentCommentsPage(): HTML.() -> Unit { val comments = CommentRenderData( Comment.Table .sorted(descending(Comment::submittedAt)) + .filterNot { comment -> + NationData.get(comment.submittedBy).isBanned + } .take(limit) .toList(), nationCache