From 9e05fd98bca64500d3fc0e532a994121f55724e6 Mon Sep 17 00:00:00 2001 From: Lanius Trolling Date: Tue, 14 Mar 2023 15:01:51 -0400 Subject: [PATCH] Filter out shadowbanned comments --- src/main/kotlin/info/mechyrdia/data/views_comment.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.25.1