Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(chat): prefer the tracked participant's display name over the message's visitor flag (#17777)

bgrozev08bbb2b47d62
diff --git a/react/features/chat/middleware.ts b/react/features/chat/middleware.ts
index 73e220700a..229685e350 100644
--- a/react/features/chat/middleware.ts
+++ b/react/features/chat/middleware.ts
@@ -907,12 +907,14 @@ function _handleReceivedMessage({ dispatch, getState }: IStore,
if (lobbyChat) {
_displayName = getLobbyChatDisplayName(state, participantId);
- } else if (isFromVisitor) {
- _displayName = getDisplayName(state, displayName);
- } else if (!participant) {
- _displayName = getDisplayName(state, displayName);
- } else {
+ } else if (participant) {
+ // A resolvable, tracked participant always takes priority over the per-message isFromVisitor flag: a real
+ // visitor is never tracked as a participant (no MUC presence), so this doesn't affect genuine visitor
+ // messages, but it makes sure the sender's own known display name is always used once they're a tracked
+ // participant, regardless of what the message itself claims.
_displayName = getParticipantDisplayName(state, participantId);
+ } else {
+ _displayName = getDisplayName(state, displayName);
}
const hasRead = participant?.local || isChatOpen;