Merge pull request #3009 from greenart7c3/claude/fix-reaction-payment-targets-UhsYP

fix: surface Pay row in Reaction Settings for existing accounts
This commit is contained in:
Vitor Pamplona
2026-05-20 11:59:29 -04:00
committed by GitHub
2 changed files with 13 additions and 2 deletions
@@ -35,7 +35,7 @@ class AccountSyncedSettings(
val reactions =
AccountReactionPreferences(
MutableStateFlow(internalSettings.reactions.reactionChoices.toImmutableList()),
MutableStateFlow(internalSettings.reactions.reactionRowItems.toImmutableList()),
MutableStateFlow(mergeWithDefaultReactionRowItems(internalSettings.reactions.reactionRowItems).toImmutableList()),
)
val zaps =
AccountZapPreferences(
@@ -96,7 +96,8 @@ class AccountSyncedSettings(
reactions.reactionChoices.tryEmit(newReactionChoices)
}
val newReactionRowItems = syncedSettingsInternal.reactions.reactionRowItems.toImmutableList()
val newReactionRowItems =
mergeWithDefaultReactionRowItems(syncedSettingsInternal.reactions.reactionRowItems).toImmutableList()
if (!equalImmutableLists(reactions.reactionRowItems.value, newReactionRowItems)) {
reactions.reactionRowItems.tryEmit(newReactionRowItems)
}
@@ -67,6 +67,16 @@ val DefaultReactionRowItems =
ReactionRowItem(ReactionRowAction.Share, showCounter = false),
)
// Existing accounts have a reaction-row list serialized before some actions
// existed (e.g. Pay was added later). Append any default items the saved list
// is missing so new actions surface without forcing a settings reset — the
// user's existing order/toggles for actions they already have are preserved.
fun mergeWithDefaultReactionRowItems(saved: List<ReactionRowItem>): List<ReactionRowItem> {
val knownActions = saved.mapTo(mutableSetOf()) { it.action }
val missing = DefaultReactionRowItems.filter { it.action !in knownActions }
return if (missing.isEmpty()) saved else saved + missing
}
@Serializable
enum class VideoPlayerAction {
Fullscreen,