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:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user