Show on chain zaps even if only reaction
This commit is contained in:
+4
-1
@@ -333,7 +333,10 @@ fun observeNoteReferences(
|
||||
// Subscribe in the relay for changes in this note.
|
||||
EventFinderFilterAssemblerSubscription(note, accountViewModel)
|
||||
|
||||
// Subscribe in the LocalCache for changes that arrive in the device
|
||||
// Subscribe in the LocalCache for changes that arrive in the device.
|
||||
// On-chain zaps piggyback `note.flow().zaps.stateFlow` because Note.addOnchainZap
|
||||
// invalidates the same `flowSet.zaps`. If that ever moves to a dedicated flow,
|
||||
// add it here too — otherwise on-chain-only notes will stop pinging the chevron.
|
||||
val flow =
|
||||
remember(note) {
|
||||
combine(
|
||||
|
||||
@@ -278,7 +278,7 @@ open class Note(
|
||||
}
|
||||
}
|
||||
|
||||
fun hasZapsBoostsOrReactions(): Boolean = reactions.isNotEmpty() || zaps.isNotEmpty() || boosts.isNotEmpty()
|
||||
fun hasZapsBoostsOrReactions(): Boolean = reactions.isNotEmpty() || zaps.isNotEmpty() || boosts.isNotEmpty() || onchainZaps.isNotEmpty()
|
||||
|
||||
fun countReactions(): Int {
|
||||
var total = 0
|
||||
|
||||
+23
@@ -23,6 +23,7 @@ package com.vitorpamplona.amethyst.commons.model
|
||||
import java.math.BigDecimal
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertSame
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
@@ -104,6 +105,28 @@ class NoteOnchainZapTest {
|
||||
assertEquals(BigDecimal.valueOf(100L), target.zapsAmount)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hasZapsBoostsOrReactionsReturnsTrueWhenOnlyOnchainZapPresent() {
|
||||
val target = freshNote()
|
||||
val src = sourceNote("9".repeat(64))
|
||||
|
||||
assertFalse(target.hasZapsBoostsOrReactions())
|
||||
|
||||
target.addOnchainZap(source = src, txid = "tx1", verifiedSats = 6416L, confirmed = true)
|
||||
|
||||
assertTrue(target.hasZapsBoostsOrReactions())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hasZapsBoostsOrReactionsReturnsTrueWhenOnlyPendingOnchainZapPresent() {
|
||||
val target = freshNote()
|
||||
val src = sourceNote("8".repeat(64))
|
||||
|
||||
target.addOnchainZap(source = src, txid = "tx1", verifiedSats = 1000L, confirmed = false)
|
||||
|
||||
assertTrue(target.hasZapsBoostsOrReactions())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun updateZapTotalSumsConfirmedAcrossMultipleTxids() {
|
||||
val target = freshNote()
|
||||
|
||||
Reference in New Issue
Block a user