mirror of
https://github.com/KRTirtho/spotube.git
synced 2026-11-04 10:13:59 +00:00
fix(jam): prevent self from showing in moderation menu during host takeover
Fixes race condition where guest taking over as host would see 'manage' button for themselves during presence propagation delay (MQTT round-trip). - Add localClientId to UI state combine - Update canModerate: role == Host && !participant.isHost && participant.id != localClientId
This commit is contained in:
parent
3ae00f296a
commit
eabb432f4a
@ -102,7 +102,9 @@ class JamViewModel(
|
||||
codeCopied,
|
||||
snapshotFlow { codeInput.text.toString() },
|
||||
participantMenu,
|
||||
isLeaving
|
||||
isLeaving,
|
||||
// Local client ID to exclude self from moderation menu
|
||||
jamRoomService.participantClientId
|
||||
) { values ->
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val role = values[0] as JamRole?
|
||||
@ -116,6 +118,7 @@ class JamViewModel(
|
||||
val localError = values[6] as String?
|
||||
val busy = values[8] as Boolean
|
||||
val brokerConfigured = !settings?.jamBroker?.host.isNullOrBlank()
|
||||
val localClientId = values[13] as String
|
||||
|
||||
JamUiState(
|
||||
isActive = role != null,
|
||||
@ -127,7 +130,8 @@ class JamViewModel(
|
||||
displayName = participant.displayName,
|
||||
initial = participant.displayName.firstOrNull()?.uppercase() ?: "?",
|
||||
isHost = participant.isHost,
|
||||
canModerate = role == JamRole.Host && !participant.isHost,
|
||||
// Host can moderate OTHER participants only (not self)
|
||||
canModerate = role == JamRole.Host && !participant.isHost && participant.id != localClientId,
|
||||
menuExpanded = values[11] == participant.id
|
||||
)
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user