Files
upstream-mirror 1d2bfcac0c
Some checks failed
Prosody Plugin Tests / test (push) Failing after 10m11s
Close stale issues and PRs / stale (push) Failing after 1s
snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
2026-09-15 15:56:32 +05:00

47 lines
1.6 KiB
TypeScript

import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
import { showErrorNotification } from '../notifications/actions';
import { maybeNotifyRecordingStart, maybeNotifyRecordingStop } from '../recording/middleware';
import { setSubtitlesError } from '../subtitles/actions.any';
import { TRANSCRIBER_LEFT } from './actionTypes';
import './subscriber';
/**
* Implements the middleware of the feature transcribing.
*
* @param {Store} store - The redux store.
* @returns {Function}
*/
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
switch (action.type) {
case TRANSCRIBER_LEFT: {
if (action.abruptly) {
dispatch(showErrorNotification({
titleKey: 'transcribing.failed'
}));
// TRANSCRIBER_LEFT resets subtitles state to default (_hasError: false).
// If we're in the coordinated start flow, we need _hasError = true
// so maybeNotifyRecordingStart sees transcription as resolved-failed.
const startIntent = getState()['features/recording'].startRecordingIntent;
if (startIntent) {
dispatch(setSubtitlesError(true));
maybeNotifyRecordingStart(dispatch, getState);
}
// If we're in the coordinated stop flow, the transcriber leaving is
// the transcription resolution — re-evaluate.
const stopIntent = getState()['features/recording'].stopRecordingIntent;
if (stopIntent) {
maybeNotifyRecordingStop(dispatch, getState);
}
}
break;
}
}
return next(action);
});