Avoids displaying a NIP-94 event without a url tag

This commit is contained in:
Vitor Pamplona
2023-08-14 16:33:47 -04:00
parent d934e28b3a
commit 6ab061a5a2
2 changed files with 3 additions and 1 deletions

View File

@@ -26,6 +26,8 @@ class FileHeaderEvent(
fun torrentInfoHash() = tags.firstOrNull { it.size > 1 && it[0] == TORRENT_INFOHASH }?.get(1) fun torrentInfoHash() = tags.firstOrNull { it.size > 1 && it[0] == TORRENT_INFOHASH }?.get(1)
fun blurhash() = tags.firstOrNull { it.size > 1 && it[0] == BLUR_HASH }?.get(1) fun blurhash() = tags.firstOrNull { it.size > 1 && it[0] == BLUR_HASH }?.get(1)
fun hasUrl() = tags.any { it.size > 1 && it[0] == URL }
companion object { companion object {
const val kind = 1063 const val kind = 1063

View File

@@ -37,7 +37,7 @@ class VideoFeedFilter(val account: Account) : AdditiveFeedFilter<Note>() {
return collection return collection
.asSequence() .asSequence()
.filter { it.event is FileHeaderEvent || it.event is FileStorageHeaderEvent } .filter { (it.event is FileHeaderEvent && (it.event as FileHeaderEvent).hasUrl()) || it.event is FileStorageHeaderEvent }
.filter { isGlobal || it.author?.pubkeyHex in followingKeySet || (it.event?.isTaggedHashes(followingTagSet) ?: false) || (it.event?.isTaggedGeoHashes(followingGeohashSet) ?: false) } .filter { isGlobal || it.author?.pubkeyHex in followingKeySet || (it.event?.isTaggedHashes(followingTagSet) ?: false) || (it.event?.isTaggedGeoHashes(followingGeohashSet) ?: false) }
.filter { isHiddenList || account.isAcceptable(it) } .filter { isHiddenList || account.isAcceptable(it) }
.filter { it.createdAt()!! <= now } .filter { it.createdAt()!! <= now }