Add notification setting to hide hellthreads

Changelog-Added: Add notification setting to hide hellthreads
Closes: https://github.com/damus-io/damus/issues/2943
Signed-off-by: Terry Yiu <git@tyiu.xyz>
This commit is contained in:
2025-03-29 10:21:19 -04:00
committed by Daniel D’Aquino
parent d1cced8d54
commit c146bab08a
11 changed files with 147 additions and 95 deletions

View File

@@ -13,6 +13,7 @@ import secp256k1_implementation
import CryptoKit
let MAX_NOTE_SIZE: Int = 2 << 18
let MIN_HELLTHREAD_PUBKEYS = 11
struct NdbStr {
let note: NdbNote
@@ -299,6 +300,15 @@ extension NdbNote {
return !too_big
}
var is_hellthread: Bool {
switch known_kind {
case .text, .boost, .like, .zap:
Set(referenced_pubkeys).count >= MIN_HELLTHREAD_PUBKEYS
default:
false
}
}
func get_blocks(keypair: Keypair) -> Blocks {
return parse_note_content(content: .init(note: self, keypair: keypair))
}