feat(zap-splits): hide single-author zap split row in NoteCompose

When a note's only zap split recipient is the post author, the split is
redundant — the author already receives the zap. Skip rendering the row
in those cases by gating on a new `hasZapSplitSetupBesidesAuthor` helper.
This commit is contained in:
Claude
2026-05-27 14:54:48 +00:00
parent d381cf9109
commit e876e2b09b
2 changed files with 14 additions and 4 deletions
@@ -275,7 +275,7 @@ import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEven
import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent
import com.vitorpamplona.quartz.nip56Reports.ReportEvent
import com.vitorpamplona.quartz.nip57Zaps.LnZapEvent
import com.vitorpamplona.quartz.nip57Zaps.splits.hasZapSplitSetup
import com.vitorpamplona.quartz.nip57Zaps.splits.hasZapSplitSetupBesidesAuthor
import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent
import com.vitorpamplona.quartz.nip58Badges.definition.BadgeDefinitionEvent
import com.vitorpamplona.quartz.nip5aStaticWebsites.NamedSiteEvent
@@ -727,7 +727,7 @@ fun InnerNoteWithReactions(
if (!makeItShort) {
val noteEvent = baseNote.event
val zapSplits = remember(noteEvent) { noteEvent?.hasZapSplitSetup() ?: false }
val zapSplits = remember(noteEvent) { noteEvent?.hasZapSplitSetupBesidesAuthor() ?: false }
if (zapSplits && noteEvent != null) {
Spacer(modifier = HalfDoubleVertSpacer)
DisplayZapSplits(noteEvent, false, accountViewModel, nav)
@@ -851,7 +851,7 @@ fun NoteBody(
if (!makeItShort) {
val noteEvent = baseNote.event
val zapSplits = remember(noteEvent) { noteEvent?.hasZapSplitSetup() ?: false }
val zapSplits = remember(noteEvent) { noteEvent?.hasZapSplitSetupBesidesAuthor() ?: false }
if (zapSplits && noteEvent != null) {
Spacer(modifier = HalfDoubleVertSpacer)
DisplayZapSplits(noteEvent, false, accountViewModel, nav)
@@ -1502,7 +1502,7 @@ fun RenderDraft(
nav = nav,
)
val zapSplits = remember(it.event) { it.event?.hasZapSplitSetup() }
val zapSplits = remember(it.event) { it.event?.hasZapSplitSetupBesidesAuthor() }
if (zapSplits == true) {
Spacer(modifier = HalfDoubleVertSpacer)
DisplayZapSplits(it.event!!, false, accountViewModel, nav)
@@ -25,3 +25,13 @@ import com.vitorpamplona.quartz.nip01Core.core.Event
fun Event.hasZapSplitSetup() = tags.hasZapSplitSetup()
fun Event.zapSplitSetup(): List<BaseZapSplitSetup> = tags.zapSplitSetup()
fun Event.hasZapSplitSetupBesidesAuthor(): Boolean {
val list = zapSplitSetup()
if (list.isEmpty()) return false
if (list.size == 1) {
val only = list.first()
if (only is ZapSplitSetup && only.pubKeyHex == pubKey) return false
}
return true
}