瀏覽代碼

Get chat message display name from backend

master
Bettenbuk Zoltan 5 年之前
父節點
當前提交
e7144eb674
共有 4 個檔案被更改,包括 9 行新增6 行删除
  1. 2
    2
      package-lock.json
  2. 1
    1
      package.json
  3. 4
    1
      react/features/chat/components/native/ChatMessage.js
  4. 2
    2
      react/features/chat/middleware.js

+ 2
- 2
package-lock.json 查看文件

9073
       }
9073
       }
9074
     },
9074
     },
9075
     "lib-jitsi-meet": {
9075
     "lib-jitsi-meet": {
9076
-      "version": "github:jitsi/lib-jitsi-meet#3c8058743177b6b6963d3bc3df14f4ea650ef310",
9077
-      "from": "github:jitsi/lib-jitsi-meet#3c8058743177b6b6963d3bc3df14f4ea650ef310",
9076
+      "version": "github:jitsi/lib-jitsi-meet#502ba82e1e4e4cdf8fe768566b6414f5c100491a",
9077
+      "from": "github:jitsi/lib-jitsi-meet#502ba82e1e4e4cdf8fe768566b6414f5c100491a",
9078
       "requires": {
9078
       "requires": {
9079
         "@jitsi/sdp-interop": "0.1.14",
9079
         "@jitsi/sdp-interop": "0.1.14",
9080
         "@jitsi/sdp-simulcast": "0.2.1",
9080
         "@jitsi/sdp-simulcast": "0.2.1",

+ 1
- 1
package.json 查看文件

54
     "js-utils": "github:jitsi/js-utils#192b1c996e8c05530eb1f19e82a31069c3021e31",
54
     "js-utils": "github:jitsi/js-utils#192b1c996e8c05530eb1f19e82a31069c3021e31",
55
     "jsrsasign": "8.0.12",
55
     "jsrsasign": "8.0.12",
56
     "jwt-decode": "2.2.0",
56
     "jwt-decode": "2.2.0",
57
-    "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#3c8058743177b6b6963d3bc3df14f4ea650ef310",
57
+    "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#502ba82e1e4e4cdf8fe768566b6414f5c100491a",
58
     "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
58
     "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
59
     "lodash": "4.17.11",
59
     "lodash": "4.17.11",
60
     "moment": "2.19.4",
60
     "moment": "2.19.4",

+ 4
- 1
react/features/chat/components/native/ChatMessage.js 查看文件

74
      * @returns {React$Element<*>}
74
      * @returns {React$Element<*>}
75
      */
75
      */
76
     _renderAvatar() {
76
     _renderAvatar() {
77
+        const { message } = this.props;
78
+
77
         return (
79
         return (
78
             <View style = { styles.avatarWrapper }>
80
             <View style = { styles.avatarWrapper }>
79
                 { this.props.showAvatar && <Avatar
81
                 { this.props.showAvatar && <Avatar
80
-                    participantId = { this.props.message.id }
82
+                    displayName = { message.displayName }
83
+                    participantId = { message.id }
81
                     size = { styles.avatarWrapper.width } />
84
                     size = { styles.avatarWrapper.width } />
82
                 }
85
                 }
83
             </View>
86
             </View>

+ 2
- 2
react/features/chat/middleware.js 查看文件

115
 
115
 
116
     conference.on(
116
     conference.on(
117
         JitsiConferenceEvents.MESSAGE_RECEIVED,
117
         JitsiConferenceEvents.MESSAGE_RECEIVED,
118
-        (id, message, timestamp) => {
118
+        (id, message, timestamp, nick) => {
119
             // Logic for all platforms:
119
             // Logic for all platforms:
120
             const state = getState();
120
             const state = getState();
121
             const { isOpen: isChatOpen } = state['features/chat'];
121
             const { isOpen: isChatOpen } = state['features/chat'];
127
             // Provide a default for for the case when a message is being
127
             // Provide a default for for the case when a message is being
128
             // backfilled for a participant that has left the conference.
128
             // backfilled for a participant that has left the conference.
129
             const participant = getParticipantById(state, id) || {};
129
             const participant = getParticipantById(state, id) || {};
130
-            const displayName = getParticipantDisplayName(getState, id);
130
+            const displayName = participant.name || nick || getParticipantDisplayName(state, id);
131
             const hasRead = participant.local || isChatOpen;
131
             const hasRead = participant.local || isChatOpen;
132
             const timestampToDate = timestamp
132
             const timestampToDate = timestamp
133
                 ? new Date(timestamp) : new Date();
133
                 ? new Date(timestamp) : new Date();

Loading…
取消
儲存