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

ref(notifications): do not notify of local participant left

Join notifications are already supressed for the local
participant, so hide the left notification. For now
the notification is not being shown on mobile to keep
the same existing behavior and because a copy change
will be needed, but will be added once batching is
implemented.
master
Leonard Kim 6 роки тому
джерело
коміт
c0376d238a
2 змінених файлів з 30 додано та 8 видалено
  1. 0
    5
      conference.js
  2. 30
    3
      react/features/notifications/middleware.js

+ 0
- 5
conference.js Переглянути файл

1781
 
1781
 
1782
             logger.log(`USER ${id} LEFT:`, user);
1782
             logger.log(`USER ${id} LEFT:`, user);
1783
             APP.API.notifyUserLeft(id);
1783
             APP.API.notifyUserLeft(id);
1784
-            APP.UI.messageHandler.participantNotification(
1785
-                user.getDisplayName(),
1786
-                'notify.somebody',
1787
-                'disconnected',
1788
-                'notify.disconnected');
1789
             APP.UI.onSharedVideoStop(id);
1784
             APP.UI.onSharedVideoStop(id);
1790
         });
1785
         });
1791
 
1786
 

+ 30
- 3
react/features/notifications/middleware.js Переглянути файл

3
 import { getCurrentConference } from '../base/conference';
3
 import { getCurrentConference } from '../base/conference';
4
 import {
4
 import {
5
     PARTICIPANT_JOINED,
5
     PARTICIPANT_JOINED,
6
+    PARTICIPANT_LEFT,
7
+    getParticipantById,
6
     getParticipantDisplayName
8
     getParticipantDisplayName
7
 } from '../base/participants';
9
 } from '../base/participants';
8
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
10
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
9
 
11
 
10
 import {
12
 import {
11
     clearNotifications,
13
     clearNotifications,
14
+    showNotification,
12
     showParticipantJoinedNotification
15
     showParticipantJoinedNotification
13
 } from './actions';
16
 } from './actions';
17
+import { NOTIFICATION_TIMEOUT } from './constants';
18
+
19
+declare var interfaceConfig: Object;
14
 
20
 
15
 /**
21
 /**
16
  * Middleware that captures actions to display notifications.
22
  * Middleware that captures actions to display notifications.
19
  * @returns {Function}
25
  * @returns {Function}
20
  */
26
  */
21
 MiddlewareRegistry.register(store => next => action => {
27
 MiddlewareRegistry.register(store => next => action => {
22
-    const result = next(action);
23
-
24
     switch (action.type) {
28
     switch (action.type) {
25
     case PARTICIPANT_JOINED: {
29
     case PARTICIPANT_JOINED: {
30
+        const result = next(action);
31
+
26
         const { participant: p } = action;
32
         const { participant: p } = action;
27
 
33
 
28
         if (!p.local) {
34
         if (!p.local) {
30
                 getParticipantDisplayName(store.getState, p.id)
36
                 getParticipantDisplayName(store.getState, p.id)
31
             ));
37
             ));
32
         }
38
         }
39
+
40
+        return result;
41
+    }
42
+    case PARTICIPANT_LEFT: {
43
+        const participant = getParticipantById(
44
+            store.getState(),
45
+            action.participant.id
46
+        );
47
+
48
+        if (typeof interfaceConfig === 'object'
49
+            && participant
50
+            && !participant.local) {
51
+            store.dispatch(showNotification({
52
+                descriptionKey: 'notify.disconnected',
53
+                titleKey: 'notify.somebody',
54
+                title: participant.name
55
+            },
56
+            NOTIFICATION_TIMEOUT));
57
+        }
58
+
59
+        return next(action);
33
     }
60
     }
34
     }
61
     }
35
 
62
 
36
-    return result;
63
+    return next(action);
37
 });
64
 });
38
 
65
 
39
 /**
66
 /**

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