Browse Source

fix(participants-pane): Use selector for displaying names

j8
Gabriel Imre 3 years ago
parent
commit
d69d4dd91a

+ 11
- 0
react/features/base/participants/functions.js View File

@@ -185,6 +185,17 @@ export function getParticipantDisplayName(
185 185
         : 'Fellow Jitster';
186 186
 }
187 187
 
188
+/**
189
+ * Curried version of getParticipantDisplayName.
190
+ *
191
+ * @see {@link getParticipantDisplayName}
192
+ * @param {string} id - The ID of the participant's display name to retrieve.
193
+ * @returns {Function}
194
+ */
195
+export const getParticipantDisplayNameWithId = (id: string) =>
196
+    (state: Object | Function) =>
197
+        getParticipantDisplayName(state, id);
198
+
188 199
 /**
189 200
  * Returns the presence status of a participant associated with the passed id.
190 201
  *

+ 4
- 1
react/features/participants-pane/components/ParticipantItem.js View File

@@ -2,6 +2,7 @@
2 2
 
3 3
 import React, { type Node } from 'react';
4 4
 import { useTranslation } from 'react-i18next';
5
+import { useSelector } from 'react-redux';
5 6
 
6 7
 import { Avatar } from '../../base/avatar';
7 8
 import {
@@ -11,6 +12,7 @@ import {
11 12
     IconMicrophoneEmpty,
12 13
     IconMicrophoneEmptySlash
13 14
 } from '../../base/icons';
15
+import { getParticipantDisplayNameWithId } from '../../base/participants';
14 16
 import { ActionTrigger, MediaState } from '../constants';
15 17
 
16 18
 import { RaisedHandIndicator } from './RaisedHandIndicator';
@@ -125,6 +127,7 @@ export const ParticipantItem = ({
125 127
 }: Props) => {
126 128
     const ParticipantActions = Actions[actionsTrigger];
127 129
     const { t } = useTranslation();
130
+    const name = useSelector(getParticipantDisplayNameWithId(p.id));
128 131
 
129 132
     return (
130 133
         <ParticipantContainer
@@ -138,7 +141,7 @@ export const ParticipantItem = ({
138 141
             <ParticipantContent>
139 142
                 <ParticipantNameContainer>
140 143
                     <ParticipantName>
141
-                        { p.name }
144
+                        { name }
142 145
                     </ParticipantName>
143 146
                     { p.local ? <span>&nbsp;({t('chat.you')})</span> : null }
144 147
                 </ParticipantNameContainer>

Loading…
Cancel
Save