Selaa lähdekoodia

Notify for kick and mute (#4328)

* Updates kick showing who kicked us.

* Notify participants that someone was kicked.

* Shows notification to user who is remotely muted.

* Updates the notification type.

* Muted by notification for mobile.

* Moves code to react and adds the kick notifications to mobile.

* Updates lib-jitsi-meet.
master
Дамян Минков 6 vuotta sitten
vanhempi
commit
6eb66b639e
No account linked to committer's email address

+ 15
- 2
conference.js Näytä tiedosto

@@ -86,6 +86,8 @@ import {
86 86
     localParticipantConnectionStatusChanged,
87 87
     localParticipantRoleChanged,
88 88
     participantConnectionStatusChanged,
89
+    participantKicked,
90
+    participantMutedUs,
89 91
     participantPresenceChanged,
90 92
     participantRoleChanged,
91 93
     participantUpdated
@@ -103,6 +105,7 @@ import {
103 105
     getLocationContextRoot,
104 106
     getJitsiMeetGlobalNS
105 107
 } from './react/features/base/util';
108
+import { notifyKickedOut } from './react/features/conference';
106 109
 import { addMessage } from './react/features/chat';
107 110
 import { showDesktopPicker } from './react/features/desktop-picker';
108 111
 import { appendSuffix } from './react/features/display-name';
@@ -1858,6 +1861,12 @@ export default {
1858 1861
             APP.UI.setAudioLevel(id, newLvl);
1859 1862
         });
1860 1863
 
1864
+        room.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED, (_, participantThatMutedUs) => {
1865
+            if (participantThatMutedUs) {
1866
+                APP.store.dispatch(participantMutedUs(participantThatMutedUs));
1867
+            }
1868
+        });
1869
+
1861 1870
         room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => {
1862 1871
             APP.UI.showToolbar(6000);
1863 1872
         });
@@ -1958,13 +1967,17 @@ export default {
1958 1967
                 }
1959 1968
             });
1960 1969
 
1961
-        room.on(JitsiConferenceEvents.KICKED, () => {
1970
+        room.on(JitsiConferenceEvents.KICKED, participant => {
1962 1971
             APP.UI.hideStats();
1963
-            APP.UI.notifyKicked();
1972
+            APP.store.dispatch(notifyKickedOut(participant));
1964 1973
 
1965 1974
             // FIXME close
1966 1975
         });
1967 1976
 
1977
+        room.on(JitsiConferenceEvents.PARTICIPANT_KICKED, (kicker, kicked) => {
1978
+            APP.store.dispatch(participantKicked(kicker, kicked));
1979
+        });
1980
+
1968 1981
         room.on(JitsiConferenceEvents.SUSPEND_DETECTED, () => {
1969 1982
             APP.store.dispatch(suspendDetected());
1970 1983
 

+ 5
- 2
lang/main.json Näytä tiedosto

@@ -197,11 +197,11 @@
197 197
         "internalError": "Oops! Something went wrong. The following error occurred: __error__",
198 198
         "internalErrorTitle": "Internal error",
199 199
         "joinAgain": "Join again",
200
-        "kickMessage": "Ouch! You have been kicked out of the meet!",
200
+        "kickMessage": "You can contact __participantDisplayName__ for more details.",
201 201
         "kickParticipantButton": "Kick",
202 202
         "kickParticipantDialog": "Are you sure you want to kick this participant?",
203 203
         "kickParticipantTitle": "Kick this member?",
204
-        "kickTitle": "Kicked from meeting",
204
+        "kickTitle": "Ouch! __participantDisplayName__ kicked you out of the meeting",
205 205
         "liveStreaming": "Live Streaming",
206 206
         "liveStreamingDisabledForGuestTooltip": "Guests can't start live streaming.",
207 207
         "liveStreamingDisabledTooltip": "Start live stream disabled.",
@@ -472,10 +472,13 @@
472 472
         "focus": "Conference focus",
473 473
         "focusFail": "__component__ not available - retry in __ms__ sec",
474 474
         "grantedTo": "Moderator rights granted to __to__!",
475
+        "kickParticipant": "__kicked__ was kicked by __kicker__",
475 476
         "me": "Me",
476 477
         "moderator": "Moderator rights granted!",
477 478
         "muted": "You have started the conversation muted.",
478 479
         "mutedTitle": "You're muted!",
480
+        "mutedRemotelyTitle": "You have been muted by __participantDisplayName__!",
481
+        "mutedRemotelyDescription": "You can always unmute when you're ready to speak. Mute back when you're done to keep noise away from the meeting.",
479 482
         "raisedHand": "__name__ would like to speak.",
480 483
         "somebody": "Somebody",
481 484
         "startSilentTitle": "You joined with no audio output!",

+ 0
- 11
modules/UI/UI.js Näytä tiedosto

@@ -99,17 +99,6 @@ UI.notifyReservationError = function(code, msg) {
99 99
     });
100 100
 };
101 101
 
102
-/**
103
- * Notify user that he has been kicked from the server.
104
- */
105
-UI.notifyKicked = function() {
106
-    messageHandler.showError({
107
-        hideErrorSupportLink: true,
108
-        descriptionKey: 'dialog.kickMessage',
109
-        titleKey: 'dialog.kickTitle'
110
-    });
111
-};
112
-
113 102
 /**
114 103
  * Notify user that conference was destroyed.
115 104
  * @param reason {string} the reason text

+ 2
- 2
package-lock.json Näytä tiedosto

@@ -8946,8 +8946,8 @@
8946 8946
       }
8947 8947
     },
8948 8948
     "lib-jitsi-meet": {
8949
-      "version": "github:jitsi/lib-jitsi-meet#25ca5cbd2a93150e74f029075bc7ac734ed97a2f",
8950
-      "from": "github:jitsi/lib-jitsi-meet#25ca5cbd2a93150e74f029075bc7ac734ed97a2f",
8949
+      "version": "github:jitsi/lib-jitsi-meet#15e09476cdae1dee8f633c628681449be26d12be",
8950
+      "from": "github:jitsi/lib-jitsi-meet#15e09476cdae1dee8f633c628681449be26d12be",
8951 8951
       "requires": {
8952 8952
         "@jitsi/sdp-interop": "0.1.14",
8953 8953
         "@jitsi/sdp-simulcast": "0.2.1",

+ 1
- 1
package.json Näytä tiedosto

@@ -52,7 +52,7 @@
52 52
     "js-utils": "github:jitsi/js-utils#73a67a7a60d52f8e895f50939c8fcbd1f20fe7b5",
53 53
     "jsrsasign": "8.0.12",
54 54
     "jwt-decode": "2.2.0",
55
-    "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#25ca5cbd2a93150e74f029075bc7ac734ed97a2f",
55
+    "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#15e09476cdae1dee8f633c628681449be26d12be",
56 56
     "libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
57 57
     "lodash": "4.17.11",
58 58
     "moment": "2.19.4",

+ 22
- 4
react/features/base/conference/actions.js Näytä tiedosto

@@ -14,6 +14,8 @@ import {
14 14
     dominantSpeakerChanged,
15 15
     getNormalizedDisplayName,
16 16
     participantConnectionStatusChanged,
17
+    participantKicked,
18
+    participantMutedUs,
17 19
     participantPresenceChanged,
18 20
     participantRoleChanged,
19 21
     participantUpdated
@@ -89,7 +91,11 @@ function _addConferenceListeners(conference, dispatch) {
89 91
 
90 92
     conference.on(
91 93
         JitsiConferenceEvents.KICKED,
92
-        () => dispatch(kickedOut(conference)));
94
+        (...args) => dispatch(kickedOut(conference, ...args)));
95
+
96
+    conference.on(
97
+        JitsiConferenceEvents.PARTICIPANT_KICKED,
98
+        (kicker, kicked) => dispatch(participantKicked(kicker, kicked)));
93 99
 
94 100
     conference.on(
95 101
         JitsiConferenceEvents.LOCK_STATE_CHANGED,
@@ -129,6 +135,14 @@ function _addConferenceListeners(conference, dispatch) {
129 135
         JitsiConferenceEvents.TRACK_REMOVED,
130 136
         t => t && !t.isLocal() && dispatch(trackRemoved(t)));
131 137
 
138
+    conference.on(
139
+        JitsiConferenceEvents.TRACK_MUTE_CHANGED,
140
+        (_, participantThatMutedUs) => {
141
+            if (participantThatMutedUs) {
142
+                dispatch(participantMutedUs(participantThatMutedUs));
143
+            }
144
+        });
145
+
132 146
     // Dispatches into features/base/participants follow:
133 147
     conference.on(
134 148
         JitsiConferenceEvents.DISPLAY_NAME_CHANGED,
@@ -432,15 +446,19 @@ export function dataChannelOpened() {
432 446
  *
433 447
  * @param {JitsiConference} conference - The {@link JitsiConference} instance
434 448
  * for which the event is being signaled.
449
+ * @param {JitsiParticipant} participant - The {@link JitsiParticipant}
450
+ * instance which initiated the kick event.
435 451
  * @returns {{
436 452
  *     type: KICKED_OUT,
437
- *     conference: JitsiConference
453
+ *     conference: JitsiConference,
454
+ *     participant: JitsiParticipant
438 455
  * }}
439 456
  */
440
-export function kickedOut(conference: Object) {
457
+export function kickedOut(conference: Object, participant: Object) {
441 458
     return {
442 459
         type: KICKED_OUT,
443
-        conference
460
+        conference,
461
+        participant
444 462
     };
445 463
 }
446 464
 

+ 50
- 1
react/features/base/participants/actions.js Näytä tiedosto

@@ -17,7 +17,11 @@ import {
17 17
     PARTICIPANT_UPDATED,
18 18
     PIN_PARTICIPANT
19 19
 } from './actionTypes';
20
-import { getLocalParticipant, getNormalizedDisplayName } from './functions';
20
+import {
21
+    getLocalParticipant,
22
+    getNormalizedDisplayName,
23
+    getParticipantDisplayName
24
+} from './functions';
21 25
 
22 26
 /**
23 27
  * Create an action for when dominant speaker changes.
@@ -382,6 +386,51 @@ export function participantUpdated(participant = {}) {
382 386
     };
383 387
 }
384 388
 
389
+/**
390
+ * Action to signal that a participant has muted us.
391
+ *
392
+ * @param {JitsiParticipant} participant - Information about participant.
393
+ * @returns {Promise}
394
+ */
395
+export function participantMutedUs(participant) {
396
+    return (dispatch, getState) => {
397
+        if (!participant) {
398
+            return;
399
+        }
400
+
401
+        dispatch(showNotification({
402
+            descriptionKey: 'notify.mutedRemotelyDescription',
403
+            titleKey: 'notify.mutedRemotelyTitle',
404
+            titleArguments: {
405
+                participantDisplayName:
406
+                    getParticipantDisplayName(getState, participant.getId())
407
+            }
408
+        }));
409
+    };
410
+}
411
+
412
+/**
413
+ * Action to signal that a participant had been kicked.
414
+ *
415
+ * @param {JitsiParticipant} kicker - Information about participant performing the kick.
416
+ * @param {JitsiParticipant} kicked - Information about participant that was kicked.
417
+ * @returns {Promise}
418
+ */
419
+export function participantKicked(kicker, kicked) {
420
+    return (dispatch, getState) => {
421
+
422
+        dispatch(showNotification({
423
+            titleArguments: {
424
+                kicked:
425
+                    getParticipantDisplayName(getState, kicked.getId()),
426
+                kicker:
427
+                    getParticipantDisplayName(getState, kicker.getId())
428
+            },
429
+            titleKey: 'notify.kickParticipant'
430
+        }, NOTIFICATION_TIMEOUT * 2)); // leave more time for this
431
+    };
432
+}
433
+
385 434
 /**
386 435
  * Create an action which pins a conference participant.
387 436
  *

+ 31
- 0
react/features/conference/actions.native.js Näytä tiedosto

@@ -0,0 +1,31 @@
1
+// @flow
2
+
3
+import type { Dispatch } from 'redux';
4
+
5
+import {
6
+    AlertDialog,
7
+    openDialog
8
+} from '../base/dialog';
9
+import { getParticipantDisplayName } from '../base/participants';
10
+
11
+/**
12
+ * Notify that we've been kicked out of the conference.
13
+ *
14
+ * @param {JitsiParticipant} participant - The {@link JitsiParticipant}
15
+ * instance which initiated the kick event.
16
+ * @param {?Function} submit - The function to execute after submiting the dialog.
17
+ * @returns {Function}
18
+ */
19
+export function notifyKickedOut(participant: Object, submit: ?Function) {
20
+    return (dispatch: Dispatch<any>, getState: Function) => {
21
+        dispatch(openDialog(AlertDialog, {
22
+            contentKey: {
23
+                key: 'dialog.kickTitle',
24
+                params: {
25
+                    participantDisplayName: getParticipantDisplayName(getState, participant.getId())
26
+                }
27
+            },
28
+            onSubmit: submit
29
+        }));
30
+    };
31
+}

+ 35
- 0
react/features/conference/actions.web.js Näytä tiedosto

@@ -0,0 +1,35 @@
1
+// @flow
2
+
3
+import type { Dispatch } from 'redux';
4
+
5
+import {
6
+    NOTIFICATION_TYPE,
7
+    showNotification
8
+} from '../notifications';
9
+import { getParticipantDisplayName } from '../base/participants';
10
+
11
+/**
12
+ * Notify that we've been kicked out of the conference.
13
+ *
14
+ * @param {JitsiParticipant} participant - The {@link JitsiParticipant}
15
+ * instance which initiated the kick event.
16
+ * @param {?Function} _ - Used only in native code.
17
+ * @returns {Function}
18
+ */
19
+export function notifyKickedOut(participant: Object, _: ?Function) { // eslint-disable-line no-unused-vars
20
+    return (dispatch: Dispatch<any>, getState: Function) => {
21
+        const args = {
22
+            participantDisplayName:
23
+                getParticipantDisplayName(getState, participant.getDisplayName())
24
+        };
25
+
26
+        dispatch(showNotification({
27
+            appearance: NOTIFICATION_TYPE.ERROR,
28
+            hideErrorSupportLink: true,
29
+            descriptionKey: 'dialog.kickMessage',
30
+            descriptionArguments: args,
31
+            titleKey: 'dialog.kickTitle',
32
+            titleArguments: args
33
+        }));
34
+    };
35
+}

+ 1
- 1
react/features/conference/index.js Näytä tiedosto

@@ -1,5 +1,5 @@
1 1
 // @flow
2
-
2
+export * from './actions';
3 3
 export * from './components';
4 4
 
5 5
 import './middleware';

+ 10
- 4
react/features/conference/middleware.js Näytä tiedosto

@@ -1,5 +1,5 @@
1 1
 // @flow
2
-
2
+import { notifyKickedOut } from './actions';
3 3
 import { appNavigate } from '../app';
4 4
 import {
5 5
     CONFERENCE_JOINED,
@@ -43,9 +43,15 @@ MiddlewareRegistry.register(store => next => action => {
43 43
     case KICKED_OUT: {
44 44
         const { dispatch } = store;
45 45
 
46
-        dispatch(
47
-            conferenceFailed(action.conference, JitsiConferenceEvents.KICKED));
48
-        dispatch(appNavigate(undefined));
46
+        dispatch(notifyKickedOut(
47
+            action.participant,
48
+            () => {
49
+                dispatch(
50
+                    conferenceFailed(action.conference, JitsiConferenceEvents.KICKED));
51
+                dispatch(appNavigate(undefined));
52
+            }
53
+        ));
54
+
49 55
         break;
50 56
     }
51 57
     }

Loading…
Peruuta
Tallenna