Переглянути джерело

Merge pull request #2078 from jitsi/contactlist_displayname

fix(ContactListPanel): default display name
master
virtuacoplenny 7 роки тому
джерело
коміт
095e4d7aa6

+ 21
- 2
react/features/contact-list/components/ContactListPanel.web.js Переглянути файл

@@ -67,8 +67,27 @@ class ContactListPanel extends Component {
67 67
      * @returns {ReactElement[]}
68 68
      */
69 69
     _renderContacts() {
70
+        const { t } = this.props;
71
+        const meString = t('me');
72
+
70 73
         return this.props._participants.map(participant => {
71
-            const { id, name } = participant;
74
+            const { id, local, name } = participant;
75
+            let displayName;
76
+
77
+            // FIXME this duplicates the logic from SpeakerStats.js, but
78
+            // currently it seems that the
79
+            // interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME is freely used in
80
+            // multiple other places. A proper fix should take care of all
81
+            // usages. Also conference.js has getParticipantDisplayName which
82
+            // generates HTML span making things even harder to be cleaned up
83
+            // properly.
84
+            if (local) {
85
+                displayName
86
+                    = name ? `${name} (${meString})` : meString;
87
+            } else {
88
+                displayName
89
+                    = name ? name : interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME;
90
+            }
72 91
 
73 92
             return (
74 93
                 <ContactListItem
@@ -76,7 +95,7 @@ class ContactListPanel extends Component {
76 95
                         ? getAvatarURL(participant) : null }
77 96
                     id = { id }
78 97
                     key = { id }
79
-                    name = { name } />
98
+                    name = { displayName } />
80 99
             );
81 100
         });
82 101
     }

Завантаження…
Відмінити
Зберегти