Parcourir la source

feat(api): add notifications for kicked participants

master
Leonard Kim il y a 6 ans
Parent
révision
0734ce7ae3

+ 13
- 0
doc/api.md Voir le fichier

387
 }
387
 }
388
 ```
388
 ```
389
 
389
 
390
+* **participantKickedOut** - event notifications about a participants being removed from the room. The listener will receive an object with the following structure:
391
+```javascript
392
+{
393
+    kicked: {
394
+        id: string, // the id of the participant removed from the room
395
+        local: boolean // whether or not the participant is the local particiapnt
396
+    },
397
+    kicker: {
398
+        id: string // the id of the participant who kicked out the other participant
399
+    }
400
+}
401
+```
402
+
390
 * **participantLeft** - event notifications about participants that leave the room. The listener will receive an object with the following structure:
403
 * **participantLeft** - event notifications about participants that leave the room. The listener will receive an object with the following structure:
391
 ```javascript
404
 ```javascript
392
 {
405
 {

+ 18
- 0
modules/API/API.js Voir le fichier

658
         });
658
         });
659
     }
659
     }
660
 
660
 
661
+    /**
662
+     * Notify external application of a participant, remote or local, being
663
+     * removed from the conference by another participant.
664
+     *
665
+     * @param {string} kicked - The ID of the participant removed from the
666
+     * conference.
667
+     * @param {string} kicker - The ID of the participant that removed the
668
+     * other participant.
669
+     * @returns {void}
670
+     */
671
+    notifyKickedOut(kicked: Object, kicker: Object) {
672
+        this._sendEvent({
673
+            name: 'participant-kicked-out',
674
+            kicked,
675
+            kicker
676
+        });
677
+    }
678
+
661
     /**
679
     /**
662
      * Notify external application of the current meeting requiring a password
680
      * Notify external application of the current meeting requiring a password
663
      * to join.
681
      * to join.

+ 1
- 0
modules/API/external/external_api.js Voir le fichier

63
     'mic-error': 'micError',
63
     'mic-error': 'micError',
64
     'outgoing-message': 'outgoingMessage',
64
     'outgoing-message': 'outgoingMessage',
65
     'participant-joined': 'participantJoined',
65
     'participant-joined': 'participantJoined',
66
+    'participant-kicked-out': 'participantKickedOut',
66
     'participant-left': 'participantLeft',
67
     'participant-left': 'participantLeft',
67
     'password-required': 'passwordRequired',
68
     'password-required': 'passwordRequired',
68
     'proxy-connection-event': 'proxyConnectionEvent',
69
     'proxy-connection-event': 'proxyConnectionEvent',

+ 12
- 0
react/features/base/participants/actionTypes.js Voir le fichier

65
  */
65
  */
66
 export const PARTICIPANT_JOINED = 'PARTICIPANT_JOINED';
66
 export const PARTICIPANT_JOINED = 'PARTICIPANT_JOINED';
67
 
67
 
68
+/**
69
+ * Action to signal that a participant has been removed from a conference by
70
+ * another participant.
71
+ *
72
+ * {
73
+ *     type: PARTICIPANT_KICKED,
74
+ *     kicked: Object,
75
+ *     kicker: Object
76
+ * }
77
+ */
78
+export const PARTICIPANT_KICKED = 'PARTICIPANT_KICKED';
79
+
68
 /**
80
 /**
69
  * Action to handle case when participant lefts.
81
  * Action to handle case when participant lefts.
70
  *
82
  *

+ 7
- 0
react/features/base/participants/actions.js Voir le fichier

9
     MUTE_REMOTE_PARTICIPANT,
9
     MUTE_REMOTE_PARTICIPANT,
10
     PARTICIPANT_ID_CHANGED,
10
     PARTICIPANT_ID_CHANGED,
11
     PARTICIPANT_JOINED,
11
     PARTICIPANT_JOINED,
12
+    PARTICIPANT_KICKED,
12
     PARTICIPANT_LEFT,
13
     PARTICIPANT_LEFT,
13
     PARTICIPANT_UPDATED,
14
     PARTICIPANT_UPDATED,
14
     PIN_PARTICIPANT
15
     PIN_PARTICIPANT
415
 export function participantKicked(kicker, kicked) {
416
 export function participantKicked(kicker, kicked) {
416
     return (dispatch, getState) => {
417
     return (dispatch, getState) => {
417
 
418
 
419
+        dispatch({
420
+            type: PARTICIPANT_KICKED,
421
+            kicked: kicked.getId(),
422
+            kicker: kicker.getId()
423
+        });
424
+
418
         dispatch(showNotification({
425
         dispatch(showNotification({
419
             titleArguments: {
426
             titleArguments: {
420
                 kicked:
427
                 kicked:

+ 25
- 1
react/features/external-api/middleware.js Voir le fichier

1
 // @flow
1
 // @flow
2
 
2
 
3
-import { CONFERENCE_FAILED, CONFERENCE_JOINED } from '../base/conference';
3
+import {
4
+    CONFERENCE_FAILED,
5
+    CONFERENCE_JOINED,
6
+    KICKED_OUT
7
+} from '../base/conference';
4
 import { NOTIFY_CAMERA_ERROR, NOTIFY_MIC_ERROR } from '../base/devices';
8
 import { NOTIFY_CAMERA_ERROR, NOTIFY_MIC_ERROR } from '../base/devices';
5
 import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
9
 import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
6
 import {
10
 import {
11
+    PARTICIPANT_KICKED,
7
     getAvatarURLByParticipantId,
12
     getAvatarURLByParticipantId,
8
     getLocalParticipant
13
     getLocalParticipant
9
 } from '../base/participants';
14
 } from '../base/participants';
53
         break;
58
         break;
54
     }
59
     }
55
 
60
 
61
+    case KICKED_OUT:
62
+        APP.API.notifyKickedOut(
63
+            {
64
+                id: getLocalParticipant(store.getState()).id,
65
+                local: true
66
+            },
67
+            { id: action.participant.getId() }
68
+        );
69
+        break;
70
+
56
     case NOTIFY_CAMERA_ERROR:
71
     case NOTIFY_CAMERA_ERROR:
57
         if (action.error) {
72
         if (action.error) {
58
             APP.API.notifyOnCameraError(
73
             APP.API.notifyOnCameraError(
66
         }
81
         }
67
         break;
82
         break;
68
 
83
 
84
+    case PARTICIPANT_KICKED:
85
+        APP.API.notifyKickedOut(
86
+            {
87
+                id: action.kicked,
88
+                local: false
89
+            },
90
+            { id: action.kicker });
91
+        break;
92
+
69
     case SET_FILMSTRIP_VISIBLE:
93
     case SET_FILMSTRIP_VISIBLE:
70
         APP.API.notifyFilmstripDisplayChanged(action.visible);
94
         APP.API.notifyFilmstripDisplayChanged(action.visible);
71
         break;
95
         break;

Chargement…
Annuler
Enregistrer