Show zap comments in threads and show top zap

Changelog-Added: Top zaps
Changelog-Added: Show zap comments in threads
This commit is contained in:
William Casarin
2023-06-09 10:10:33 +02:00
parent 8f237b47eb
commit 043eb5b436
19 changed files with 258 additions and 140 deletions

View File

@@ -21,12 +21,12 @@ class ZapGroup {
}
func zap_requests() -> [NostrEvent] {
zaps.map { z in z.request }
zaps.map { z in z.request.ev }
}
func would_filter(_ isIncluded: (NostrEvent) -> Bool) -> Bool {
for zap in zaps {
if !isIncluded(zap.request) {
if !isIncluded(zap.request.ev) {
return true
}
}
@@ -35,7 +35,7 @@ class ZapGroup {
}
func filter(_ isIncluded: (NostrEvent) -> Bool) -> ZapGroup? {
let new_zaps = zaps.filter { isIncluded($0.request) }
let new_zaps = zaps.filter { isIncluded($0.request.ev) }
guard new_zaps.count > 0 else {
return nil
}
@@ -60,8 +60,8 @@ class ZapGroup {
msat_total += zap.amount
if !zappers.contains(zap.request.pubkey) {
zappers.insert(zap.request.pubkey)
if !zappers.contains(zap.request.ev.pubkey) {
zappers.insert(zap.request.ev.pubkey)
}
return true