Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Notify for kick and mute (#4328)
Дамян Минков6eb66b639e28
diff --git a/conference.js b/conference.jsindex eb62003a16..10a2b95684 100644--- a/conference.js+++ b/conference.js@@ -86,6 +86,8 @@ import {localParticipantConnectionStatusChanged,localParticipantRoleChanged,participantConnectionStatusChanged,+ participantKicked,+ participantMutedUs,participantPresenceChanged,participantRoleChanged,participantUpdated@@ -103,6 +105,7 @@ import {getLocationContextRoot,getJitsiMeetGlobalNS} from './react/features/base/util';+import { notifyKickedOut } from './react/features/conference';import { addMessage } from './react/features/chat';import { showDesktopPicker } from './react/features/desktop-picker';import { appendSuffix } from './react/features/display-name';@@ -1858,6 +1861,12 @@ export default {APP.UI.setAudioLevel(id, newLvl);});+ room.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED, (_, participantThatMutedUs) => {+ if (participantThatMutedUs) {+ APP.store.dispatch(participantMutedUs(participantThatMutedUs));+ }+ });+room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => {APP.UI.showToolbar(6000);});@@ -1958,13 +1967,17 @@ export default {}});- room.on(JitsiConferenceEvents.KICKED, () => {+ room.on(JitsiConferenceEvents.KICKED, participant => {APP.UI.hideStats();- APP.UI.notifyKicked();+ APP.store.dispatch(notifyKickedOut(participant));// FIXME close});+ room.on(JitsiConferenceEvents.PARTICIPANT_KICKED, (kicker, kicked) => {+ APP.store.dispatch(participantKicked(kicker, kicked));+ });+room.on(JitsiConferenceEvents.SUSPEND_DETECTED, () => {APP.store.dispatch(suspendDetected());diff --git a/lang/main.json b/lang/main.jsonindex c81a4b9d8f..10baf8e752 100644--- a/lang/main.json+++ b/lang/main.json@@ -197,11 +197,11 @@"internalError": "Oops! Something went wrong. The following error occurred: __error__","internalErrorTitle": "Internal error","joinAgain": "Join again",- "kickMessage": "Ouch! You have been kicked out of the meet!",+ "kickMessage": "You can contact __participantDisplayName__ for more details.","kickParticipantButton": "Kick","kickParticipantDialog": "Are you sure you want to kick this participant?","kickParticipantTitle": "Kick this member?",- "kickTitle": "Kicked from meeting",+ "kickTitle": "Ouch! __participantDisplayName__ kicked you out of the meeting","liveStreaming": "Live Streaming","liveStreamingDisabledForGuestTooltip": "Guests can't start live streaming.","liveStreamingDisabledTooltip": "Start live stream disabled.",@@ -472,10 +472,13 @@"focus": "Conference focus","focusFail": "__component__ not available - retry in __ms__ sec","grantedTo": "Moderator rights granted to __to__!",+ "kickParticipant": "__kicked__ was kicked by __kicker__","me": "Me","moderator": "Moderator rights granted!","muted": "You have started the conversation muted.","mutedTitle": "You're muted!",+ "mutedRemotelyTitle": "You have been muted by __participantDisplayName__!",+ "mutedRemotelyDescription": "You can always unmute when you're ready to speak. Mute back when you're done to keep noise away from the meeting.","raisedHand": "__name__ would like to speak.","somebody": "Somebody","startSilentTitle": "You joined with no audio output!",diff --git a/modules/UI/UI.js b/modules/UI/UI.jsindex e2212abe28..c246294a66 100644--- a/modules/UI/UI.js+++ b/modules/UI/UI.js@@ -99,17 +99,6 @@ UI.notifyReservationError = function(code, msg) {});};-/**- * Notify user that he has been kicked from the server.- */-UI.notifyKicked = function() {- messageHandler.showError({- hideErrorSupportLink: true,- descriptionKey: 'dialog.kickMessage',- titleKey: 'dialog.kickTitle'- });-};-/*** Notify user that conference was destroyed.* @param reason {string} the reason textdiff --git a/package-lock.json b/package-lock.jsonindex d8831da4f7..75e7e4572c 100644--- a/package-lock.json+++ b/package-lock.json@@ -8946,8 +8946,8 @@}},"lib-jitsi-meet": {- "version": "github:jitsi/lib-jitsi-meet#25ca5cbd2a93150e74f029075bc7ac734ed97a2f",- "from": "github:jitsi/lib-jitsi-meet#25ca5cbd2a93150e74f029075bc7ac734ed97a2f",+ "version": "github:jitsi/lib-jitsi-meet#15e09476cdae1dee8f633c628681449be26d12be",+ "from": "github:jitsi/lib-jitsi-meet#15e09476cdae1dee8f633c628681449be26d12be","requires": {"@jitsi/sdp-interop": "0.1.14","@jitsi/sdp-simulcast": "0.2.1",diff --git a/package.json b/package.jsonindex db2223341b..f70643ac4d 100644--- a/package.json+++ b/package.json@@ -52,7 +52,7 @@"js-utils": "github:jitsi/js-utils#73a67a7a60d52f8e895f50939c8fcbd1f20fe7b5","jsrsasign": "8.0.12","jwt-decode": "2.2.0",- "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#25ca5cbd2a93150e74f029075bc7ac734ed97a2f",+ "lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#15e09476cdae1dee8f633c628681449be26d12be","libflacjs": "github:mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d","lodash": "4.17.11","moment": "2.19.4",diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.jsindex 77fd1629fd..88a29e433c 100644--- a/react/features/base/conference/actions.js+++ b/react/features/base/conference/actions.js@@ -14,6 +14,8 @@ import {dominantSpeakerChanged,getNormalizedDisplayName,participantConnectionStatusChanged,+ participantKicked,+ participantMutedUs,participantPresenceChanged,participantRoleChanged,participantUpdated@@ -89,7 +91,11 @@ function _addConferenceListeners(conference, dispatch) {conference.on(JitsiConferenceEvents.KICKED,- () => dispatch(kickedOut(conference)));+ (...args) => dispatch(kickedOut(conference, ...args)));++ conference.on(+ JitsiConferenceEvents.PARTICIPANT_KICKED,+ (kicker, kicked) => dispatch(participantKicked(kicker, kicked)));conference.on(JitsiConferenceEvents.LOCK_STATE_CHANGED,@@ -129,6 +135,14 @@ function _addConferenceListeners(conference, dispatch) {JitsiConferenceEvents.TRACK_REMOVED,t => t && !t.isLocal() && dispatch(trackRemoved(t)));+ conference.on(+ JitsiConferenceEvents.TRACK_MUTE_CHANGED,+ (_, participantThatMutedUs) => {+ if (participantThatMutedUs) {+ dispatch(participantMutedUs(participantThatMutedUs));+ }+ });+// Dispatches into features/base/participants follow:conference.on(JitsiConferenceEvents.DISPLAY_NAME_CHANGED,@@ -432,15 +446,19 @@ export function dataChannelOpened() {** @param {JitsiConference} conference - The {@link JitsiConference} instance* for which the event is being signaled.+ * @param {JitsiParticipant} participant - The {@link JitsiParticipant}+ * instance which initiated the kick event.* @returns {{* type: KICKED_OUT,- * conference: JitsiConference+ * conference: JitsiConference,+ * participant: JitsiParticipant* }}*/-export function kickedOut(conference: Object) {+export function kickedOut(conference: Object, participant: Object) {return {type: KICKED_OUT,- conference+ conference,+ participant};}diff --git a/react/features/base/participants/actions.js b/react/features/base/participants/actions.jsindex a1fed4d50f..775e0cc50a 100644--- a/react/features/base/participants/actions.js+++ b/react/features/base/participants/actions.js@@ -17,7 +17,11 @@ import {PARTICIPANT_UPDATED,PIN_PARTICIPANT} from './actionTypes';-import { getLocalParticipant, getNormalizedDisplayName } from './functions';+import {+ getLocalParticipant,+ getNormalizedDisplayName,+ getParticipantDisplayName+} from './functions';/*** Create an action for when dominant speaker changes.@@ -382,6 +386,51 @@ export function participantUpdated(participant = {}) {};}+/**+ * Action to signal that a participant has muted us.+ *+ * @param {JitsiParticipant} participant - Information about participant.+ * @returns {Promise}+ */+export function participantMutedUs(participant) {+ return (dispatch, getState) => {+ if (!participant) {+ return;+ }++ dispatch(showNotification({+ descriptionKey: 'notify.mutedRemotelyDescription',+ titleKey: 'notify.mutedRemotelyTitle',+ titleArguments: {+ participantDisplayName:+ getParticipantDisplayName(getState, participant.getId())+ }+ }));+ };+}++/**+ * Action to signal that a participant had been kicked.+ *+ * @param {JitsiParticipant} kicker - Information about participant performing the kick.+ * @param {JitsiParticipant} kicked - Information about participant that was kicked.+ * @returns {Promise}+ */+export function participantKicked(kicker, kicked) {+ return (dispatch, getState) => {++ dispatch(showNotification({+ titleArguments: {+ kicked:+ getParticipantDisplayName(getState, kicked.getId()),+ kicker:+ getParticipantDisplayName(getState, kicker.getId())+ },+ titleKey: 'notify.kickParticipant'+ }, NOTIFICATION_TIMEOUT * 2)); // leave more time for this+ };+}+/*** Create an action which pins a conference participant.*diff --git a/react/features/conference/actions.native.js b/react/features/conference/actions.native.jsnew file mode 100644index 0000000000..ff3b0c60c2--- /dev/null+++ b/react/features/conference/actions.native.js@@ -0,0 +1,31 @@+// @flow++import type { Dispatch } from 'redux';++import {+ AlertDialog,+ openDialog+} from '../base/dialog';+import { getParticipantDisplayName } from '../base/participants';++/**+ * Notify that we've been kicked out of the conference.+ *+ * @param {JitsiParticipant} participant - The {@link JitsiParticipant}+ * instance which initiated the kick event.+ * @param {?Function} submit - The function to execute after submiting the dialog.+ * @returns {Function}+ */+export function notifyKickedOut(participant: Object, submit: ?Function) {+ return (dispatch: Dispatch<any>, getState: Function) => {+ dispatch(openDialog(AlertDialog, {+ contentKey: {+ key: 'dialog.kickTitle',+ params: {+ participantDisplayName: getParticipantDisplayName(getState, participant.getId())+ }+ },+ onSubmit: submit+ }));+ };+}diff --git a/react/features/conference/actions.web.js b/react/features/conference/actions.web.jsnew file mode 100644index 0000000000..8b31b3f00e--- /dev/null+++ b/react/features/conference/actions.web.js@@ -0,0 +1,35 @@+// @flow++import type { Dispatch } from 'redux';++import {+ NOTIFICATION_TYPE,+ showNotification+} from '../notifications';+import { getParticipantDisplayName } from '../base/participants';++/**+ * Notify that we've been kicked out of the conference.+ *+ * @param {JitsiParticipant} participant - The {@link JitsiParticipant}+ * instance which initiated the kick event.+ * @param {?Function} _ - Used only in native code.+ * @returns {Function}+ */+export function notifyKickedOut(participant: Object, _: ?Function) { // eslint-disable-line no-unused-vars+ return (dispatch: Dispatch<any>, getState: Function) => {+ const args = {+ participantDisplayName:+ getParticipantDisplayName(getState, participant.getDisplayName())+ };++ dispatch(showNotification({+ appearance: NOTIFICATION_TYPE.ERROR,+ hideErrorSupportLink: true,+ descriptionKey: 'dialog.kickMessage',+ descriptionArguments: args,+ titleKey: 'dialog.kickTitle',+ titleArguments: args+ }));+ };+}diff --git a/react/features/conference/index.js b/react/features/conference/index.jsindex 611f0c9432..01943cd7f2 100644--- a/react/features/conference/index.js+++ b/react/features/conference/index.js@@ -1,5 +1,5 @@// @flow-+export * from './actions';export * from './components';import './middleware';diff --git a/react/features/conference/middleware.js b/react/features/conference/middleware.jsindex 85015201e6..b54bf57be1 100644--- a/react/features/conference/middleware.js+++ b/react/features/conference/middleware.js@@ -1,5 +1,5 @@// @flow-+import { notifyKickedOut } from './actions';import { appNavigate } from '../app';import {CONFERENCE_JOINED,@@ -43,9 +43,15 @@ MiddlewareRegistry.register(store => next => action => {case KICKED_OUT: {const { dispatch } = store;- dispatch(- conferenceFailed(action.conference, JitsiConferenceEvents.KICKED));- dispatch(appNavigate(undefined));+ dispatch(notifyKickedOut(+ action.participant,+ () => {+ dispatch(+ conferenceFailed(action.conference, JitsiConferenceEvents.KICKED));+ dispatch(appNavigate(undefined));+ }+ ));+break;}}