diff --git a/com.stakwork.sphinx.desktop/Scenes/Dashboard/Live Kit/Views/RoomContext.swift b/com.stakwork.sphinx.desktop/Scenes/Dashboard/Live Kit/Views/RoomContext.swift index 2fdb0d57..b6d58ff0 100644 --- a/com.stakwork.sphinx.desktop/Scenes/Dashboard/Live Kit/Views/RoomContext.swift +++ b/com.stakwork.sphinx.desktop/Scenes/Dashboard/Live Kit/Views/RoomContext.swift @@ -438,19 +438,9 @@ extension RoomContext { return randomColor } - /// Returns the color for a chat message sender, matching the live participant - /// box color when the sender name corresponds to a connected participant. func getColorForMessage(senderName: String?) -> Color { - // Try to find a live participant whose name or identity matches the sender - if let senderName = senderName, - let match = room.allParticipants.values.first(where: { - $0.name == senderName || $0.identity?.stringValue == senderName - }) { - // Use the same key as participant boxes so colors stay in sync - let participantKey = match.sid?.stringValue ?? match.identity?.stringValue - return getColorForParticipan(participantId: participantKey) - } - // No live participant match — key by sender name + // Always key by senderName so history and live messages + // from the same sender share the same cached color. return getColorForParticipan(participantId: senderName) } }