ソースを参照

Add user id to analytics if provided in jwt

master
yanas 8年前
コミット
a9b8f49995
2個のファイルの変更10行の追加5行の削除
  1. 5
    4
      react/features/analytics/functions.js
  2. 5
    1
      react/features/base/jwt/middleware.js

+ 5
- 4
react/features/analytics/functions.js ファイルの表示

35
         return;
35
         return;
36
     }
36
     }
37
 
37
 
38
-    const config = getState()['features/base/config'];
38
+    const state = getState();
39
+    const config = state['features/base/config'];
39
     const { analyticsScriptUrls } = config;
40
     const { analyticsScriptUrls } = config;
40
     const machineId = JitsiMeetJS.getMachineId();
41
     const machineId = JitsiMeetJS.getMachineId();
42
+    const { user } = state['features/base/jwt'];
41
     const handlerConstructorOptions = {
43
     const handlerConstructorOptions = {
42
         product: 'lib-jitsi-meet',
44
         product: 'lib-jitsi-meet',
43
         version: JitsiMeetJS.version,
45
         version: JitsiMeetJS.version,
44
         session: machineId,
46
         session: machineId,
45
-        user: `uid-${machineId}`,
46
-        server: getState()['features/base/connection'].locationURL.host
47
+        user: user ? user.id : `uid-${machineId}`,
48
+        server: state['features/base/connection'].locationURL.host
47
     };
49
     };
48
 
50
 
49
     _loadHandlers(analyticsScriptUrls, handlerConstructorOptions)
51
     _loadHandlers(analyticsScriptUrls, handlerConstructorOptions)
50
         .then(handlers => {
52
         .then(handlers => {
51
-            const state = getState();
52
             const permanentProperties: Object = {
53
             const permanentProperties: Object = {
53
                 roomName: state['features/base/conference'].room,
54
                 roomName: state['features/base/conference'].room,
54
                 userAgent: navigator.userAgent
55
                 userAgent: navigator.userAgent

+ 5
- 1
react/features/base/jwt/middleware.js ファイルの表示

288
  * @returns {{
288
  * @returns {{
289
  *     avatarURL: ?string,
289
  *     avatarURL: ?string,
290
  *     email: ?string,
290
  *     email: ?string,
291
+ *     id: ?string,
291
  *     name: ?string
292
  *     name: ?string
292
  * }}
293
  * }}
293
  */
294
  */
294
-function _user2participant({ avatar, avatarUrl, email, name }) {
295
+function _user2participant({ avatar, avatarUrl, email, id, name }) {
295
     const participant = {};
296
     const participant = {};
296
 
297
 
297
     if (typeof avatarUrl === 'string') {
298
     if (typeof avatarUrl === 'string') {
302
     if (typeof email === 'string') {
303
     if (typeof email === 'string') {
303
         participant.email = email.trim();
304
         participant.email = email.trim();
304
     }
305
     }
306
+    if (typeof id === 'string') {
307
+        participant.id = id.trim();
308
+    }
305
     if (typeof name === 'string') {
309
     if (typeof name === 'string') {
306
         participant.name = name.trim();
310
         participant.name = name.trim();
307
     }
311
     }

読み込み中…
キャンセル
保存