Merge pull request #2949 from vitorpamplona/claude/add-zaps-to-stats-Z2qHO

feat(notifications): include onchain zaps in summary stats
This commit is contained in:
Vitor Pamplona
2026-05-16 19:07:39 -04:00
committed by GitHub
@@ -40,6 +40,7 @@ import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent
import com.vitorpamplona.quartz.nip18Reposts.RepostEvent
import com.vitorpamplona.quartz.nip25Reactions.ReactionEvent
import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent
import com.vitorpamplona.quartz.nipBCOnchainZaps.zap.OnchainZapEvent
import com.vitorpamplona.quartz.utils.Log
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
@@ -124,6 +125,17 @@ class NotificationSummaryState(
}
}
noteEvent is OnchainZapEvent -> {
if (noteEvent.isTaggedUser(currentUser)) {
val amount = noteEvent.claimedAmountInSats()
if (amount != null) {
val netDate = formatDate(noteEvent.createdAt)
zaps[netDate] = (zaps[netDate] ?: BigDecimal.ZERO) + BigDecimal.valueOf(amount)
takenIntoAccount.add(noteEvent.id)
}
}
}
noteEvent is BaseThreadedEvent &&
noteEvent.isTaggedUser(currentUser) &&
noteEvent.pubKey != currentUser -> {
@@ -198,6 +210,18 @@ class NotificationSummaryState(
}
}
noteEvent is OnchainZapEvent -> {
if (noteEvent.isTaggedUser(currentUser)) {
val amount = noteEvent.claimedAmountInSats()
if (amount != null) {
val netDate = formatDate(noteEvent.createdAt)
zaps[netDate] = (zaps[netDate] ?: BigDecimal.ZERO) + BigDecimal.valueOf(amount)
takenIntoAccount.add(noteEvent.id)
hasNewElements = true
}
}
}
noteEvent is BaseThreadedEvent &&
noteEvent.isTaggedUser(currentUser) &&
noteEvent.pubKey != currentUser -> {