Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(transcribing) show pending notification while transcriber joins

Saúl Ibarra Corretgéb56073ea6846
diff --git a/react/features/transcribing/middleware.ts b/react/features/transcribing/middleware.ts
index 0122afa201..61dfb04058 100644
--- a/react/features/transcribing/middleware.ts
+++ b/react/features/transcribing/middleware.ts
@@ -6,6 +6,7 @@ import {
PARTICIPANT_UPDATED
} from '../base/participants/actionTypes';
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
+import { SET_REQUESTING_SUBTITLES } from '../subtitles/actionTypes';
import { toggleRequestingSubtitles } from '../subtitles/actions.any';
import {
@@ -15,6 +16,7 @@ import {
import {
hidePendingTranscribingNotification,
potentialTranscriberJoined,
+ showPendingTranscribingNotification,
showStoppedTranscribingNotification,
transcriberJoined,
transcriberLeft
@@ -29,61 +31,69 @@ const TRANSCRIBER_DISPLAY_NAME = 'Transcriber';
* @returns {Function}
*/
// eslint-disable-next-line no-unused-vars
-MiddlewareRegistry.register(store => next => action => {
+MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
const {
+ isTranscribing,
transcriberJID,
potentialTranscriberJIDs
- } = store.getState()['features/transcribing'];
+ } = getState()['features/transcribing'];
switch (action.type) {
+ case _TRANSCRIBER_JOINED: {
+ const state = getState();
+ const { transcription } = state['features/base/config'];
+ const { _requestingSubtitles } = state['features/subtitles'];
+
+ if (!_requestingSubtitles && !transcription?.disableStartForAll) {
+ dispatch(toggleRequestingSubtitles());
+ }
+ break;
+ }
case _TRANSCRIBER_LEFT: {
- store.dispatch(showStoppedTranscribingNotification());
- const state = store.getState();
+ dispatch(showStoppedTranscribingNotification());
+
+ const state = getState();
const { transcription } = state['features/base/config'];
const { _requestingSubtitles } = state['features/subtitles'];
if (_requestingSubtitles && !transcription?.disableStartForAll) {
- store.dispatch(toggleRequestingSubtitles());
+ dispatch(toggleRequestingSubtitles());
}
break;
}
case HIDDEN_PARTICIPANT_JOINED:
- if (action.displayName
- && action.displayName === TRANSCRIBER_DISPLAY_NAME) {
- store.dispatch(transcriberJoined(action.id));
+ if (action.displayName === TRANSCRIBER_DISPLAY_NAME) {
+ dispatch(transcriberJoined(action.id));
} else {
- store.dispatch(potentialTranscriberJoined(action.id));
+ dispatch(potentialTranscriberJoined(action.id));
}
break;
case HIDDEN_PARTICIPANT_LEFT:
if (action.id === transcriberJID) {
- store.dispatch(transcriberLeft(action.id));
+ dispatch(transcriberLeft(action.id));
}
break;
case PARTICIPANT_UPDATED: {
const { participant } = action;
- if (potentialTranscriberJIDs.includes(participant.id)
- && participant.name === TRANSCRIBER_DISPLAY_NAME) {
+ if (potentialTranscriberJIDs.includes(participant.id) && participant.name === TRANSCRIBER_DISPLAY_NAME) {
batch(() => {
- store.dispatch(transcriberJoined(participant.id));
- store.dispatch(hidePendingTranscribingNotification());
+ dispatch(transcriberJoined(participant.id));
+ dispatch(hidePendingTranscribingNotification());
});
}
break;
}
- case _TRANSCRIBER_JOINED: {
- const state = store.getState();
- const { transcription } = state['features/base/config'];
- const { _requestingSubtitles } = state['features/subtitles'];
- if (!_requestingSubtitles && !transcription?.disableStartForAll) {
- store.dispatch(toggleRequestingSubtitles());
+ case SET_REQUESTING_SUBTITLES:
+ if (action.enabled && !isTranscribing) {
+ dispatch(showPendingTranscribingNotification());
}
+
break;
- }
+
}
return next(action);