Refactoring Note's hasReports function

This commit is contained in:
Vitor Pamplona
2023-03-15 13:12:55 -04:00
parent a9490e1299
commit 4fa7aa54a8

View File

@@ -239,9 +239,9 @@ open class Note(val idHex: String) {
val dayAgo = Date().time / 1000 - 24 * 60 * 60 val dayAgo = Date().time / 1000 - 24 * 60 * 60
return reports.isNotEmpty() || return reports.isNotEmpty() ||
( (
author?.reports?.values?.filter { author?.reports?.values?.any {
it.firstOrNull { (it.createdAt() ?: 0) > dayAgo } != null it.firstOrNull { (it.createdAt() ?: 0) > dayAgo } != null
}?.isNotEmpty() ?: false } ?: false
) )
} }