Bläddra i källkod

Add participantRoleChanged event to external API (#6573)

* Add participantRoleChanged event to external API

* Update API documentation

* Remove unneeded whitespace

* Remove more unneeded whitespace

* Fix jsdoc formatting

* Fix jsdoc formatting
master
Jim Bullington 5 år sedan
förälder
incheckning
acbf641fb4
Inget konto är kopplat till bidragsgivarens mejladress

+ 1
- 0
conference.js Visa fil

2093
                 logger.info(`My role changed, new role: ${role}`);
2093
                 logger.info(`My role changed, new role: ${role}`);
2094
 
2094
 
2095
                 APP.store.dispatch(localParticipantRoleChanged(role));
2095
                 APP.store.dispatch(localParticipantRoleChanged(role));
2096
+                APP.API.notifyUserRoleChanged(id, role);
2096
             } else {
2097
             } else {
2097
                 APP.store.dispatch(participantRoleChanged(id, role));
2098
                 APP.store.dispatch(participantRoleChanged(id, role));
2098
             }
2099
             }

+ 8
- 0
doc/api.md Visa fil

465
 }
465
 }
466
 ```
466
 ```
467
 
467
 
468
+* **participantRoleChanged** - event notification fired when the role of the local user has changed (none, moderator, participant). The listener will receive an object with the following structure:
469
+```javascript
470
+{
471
+    id: string // the id of the participant
472
+    role: string // the new role of the participant
473
+}
474
+```
475
+
468
 * **passwordRequired** - event notifications fired when failing to join a room because it has a password.
476
 * **passwordRequired** - event notifications fired when failing to join a room because it has a password.
469
 
477
 
470
 * **videoConferenceJoined** - event notifications fired when the local user has joined the video conference. The listener will receive an object with the following structure:
478
 * **videoConferenceJoined** - event notifications fired when the local user has joined the video conference. The listener will receive an object with the following structure:

+ 16
- 0
modules/API/API.js Visa fil

439
         });
439
         });
440
     }
440
     }
441
 
441
 
442
+    /**
443
+     * Notify external application (if API is enabled) that the user role
444
+     * has changed.
445
+     *
446
+     * @param {string} id - User id.
447
+     * @param {string} role - The new user role.
448
+     * @returns {void}
449
+     */
450
+    notifyUserRoleChanged(id: string, role: string) {
451
+        this._sendEvent({
452
+            name: 'participant-role-changed',
453
+            id,
454
+            role
455
+        });
456
+    }
457
+
442
     /**
458
     /**
443
      * Notify external application (if API is enabled) that user changed their
459
      * Notify external application (if API is enabled) that user changed their
444
      * avatar.
460
      * avatar.

+ 1
- 0
modules/API/external/external_api.js Visa fil

67
     'participant-joined': 'participantJoined',
67
     'participant-joined': 'participantJoined',
68
     'participant-kicked-out': 'participantKickedOut',
68
     'participant-kicked-out': 'participantKickedOut',
69
     'participant-left': 'participantLeft',
69
     'participant-left': 'participantLeft',
70
+    'participant-role-changed': 'participantRoleChanged',
70
     'password-required': 'passwordRequired',
71
     'password-required': 'passwordRequired',
71
     'proxy-connection-event': 'proxyConnectionEvent',
72
     'proxy-connection-event': 'proxyConnectionEvent',
72
     'video-ready-to-close': 'readyToClose',
73
     'video-ready-to-close': 'readyToClose',

+ 13
- 0
react/features/base/participants/actionTypes.js Visa fil

57
  */
57
  */
58
 export const PARTICIPANT_ID_CHANGED = 'PARTICIPANT_ID_CHANGED';
58
 export const PARTICIPANT_ID_CHANGED = 'PARTICIPANT_ID_CHANGED';
59
 
59
 
60
+/**
61
+ * Action to signal that participant role has changed. e.
62
+ *
63
+ * {
64
+ *     type: PARTICIPANT_ROLE_CHANGED,
65
+ *     participant: {
66
+ *         id: string
67
+ *     }
68
+ *     role: string
69
+ * }
70
+ */
71
+export const PARTICIPANT_ROLE_CHANGED = 'PARTICIPANT_ROLE_CHANGED';
72
+
60
 /**
73
 /**
61
  * Action to signal that a participant has joined.
74
  * Action to signal that a participant has joined.
62
  *
75
  *

+ 5
- 0
react/features/external-api/middleware.js Visa fil

12
     PARTICIPANT_KICKED,
12
     PARTICIPANT_KICKED,
13
     PARTICIPANT_LEFT,
13
     PARTICIPANT_LEFT,
14
     PARTICIPANT_JOINED,
14
     PARTICIPANT_JOINED,
15
+    PARTICIPANT_ROLE_CHANGED,
15
     SET_LOADABLE_AVATAR_URL,
16
     SET_LOADABLE_AVATAR_URL,
16
     getLocalParticipant,
17
     getLocalParticipant,
17
     getParticipantById
18
     getParticipantById
157
         break;
158
         break;
158
     }
159
     }
159
 
160
 
161
+    case PARTICIPANT_ROLE_CHANGED:
162
+        APP.API.notifyUserRoleChanged(action.participant.id, action.participant.role);
163
+        break;
164
+
160
     case SET_FILMSTRIP_VISIBLE:
165
     case SET_FILMSTRIP_VISIBLE:
161
         APP.API.notifyFilmstripDisplayChanged(action.visible);
166
         APP.API.notifyFilmstripDisplayChanged(action.visible);
162
         break;
167
         break;

Laddar…
Avbryt
Spara