Преглед на файлове

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,11 +1781,6 @@ export default {
1781 1781
 
1782 1782
             logger.log(`USER ${id} LEFT:`, user);
1783 1783
             APP.API.notifyUserLeft(id);
1784
-            APP.UI.messageHandler.participantNotification(
1785
-                user.getDisplayName(),
1786
-                'notify.somebody',
1787
-                'disconnected',
1788
-                'notify.disconnected');
1789 1784
             APP.UI.onSharedVideoStop(id);
1790 1785
         });
1791 1786
 

+ 30
- 3
react/features/notifications/middleware.js Целия файл

@@ -3,14 +3,20 @@
3 3
 import { getCurrentConference } from '../base/conference';
4 4
 import {
5 5
     PARTICIPANT_JOINED,
6
+    PARTICIPANT_LEFT,
7
+    getParticipantById,
6 8
     getParticipantDisplayName
7 9
 } from '../base/participants';
8 10
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
9 11
 
10 12
 import {
11 13
     clearNotifications,
14
+    showNotification,
12 15
     showParticipantJoinedNotification
13 16
 } from './actions';
17
+import { NOTIFICATION_TIMEOUT } from './constants';
18
+
19
+declare var interfaceConfig: Object;
14 20
 
15 21
 /**
16 22
  * Middleware that captures actions to display notifications.
@@ -19,10 +25,10 @@ import {
19 25
  * @returns {Function}
20 26
  */
21 27
 MiddlewareRegistry.register(store => next => action => {
22
-    const result = next(action);
23
-
24 28
     switch (action.type) {
25 29
     case PARTICIPANT_JOINED: {
30
+        const result = next(action);
31
+
26 32
         const { participant: p } = action;
27 33
 
28 34
         if (!p.local) {
@@ -30,10 +36,31 @@ MiddlewareRegistry.register(store => next => action => {
30 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
 /**

Loading…
Отказ
Запис