From a76de8c4585c08dadd4f423b3df9299d4b87ce24 Mon Sep 17 00:00:00 2001 From: Arthurk12 Date: Tue, 14 Feb 2023 14:41:45 -0300 Subject: [PATCH] feat(captions): no longer writes in the pad This feature was too coupled to the old closed captions' pads. (e.g. the old closed captions feature should be enabled for this to work properly) Some things were hardcoded and others didn't make sense from the user experience perspective. Reverts #876d8aa. Partially reverts #802964f, removes changes to make closed captions' pads compatible with live-transcription but keeps provider settings. --- .../server/handlers/transcriptUpdated.js | 12 ------------ .../ui/components/actions-bar/component.jsx | 6 ++++++ .../audio/captions/button/component.jsx | 18 +----------------- .../audio/captions/button/container.jsx | 4 ++-- .../ui/components/captions/container.jsx | 14 ++++++++++++++ .../captions/writer-menu/container.jsx | 6 +++--- .../user-list/user-list-content/component.jsx | 2 +- .../user-options/component.jsx | 17 +++++++++++++++++ 8 files changed, 44 insertions(+), 35 deletions(-) diff --git a/bigbluebutton-html5/imports/api/audio-captions/server/handlers/transcriptUpdated.js b/bigbluebutton-html5/imports/api/audio-captions/server/handlers/transcriptUpdated.js index a57d84f0a6..538de9ca3e 100644 --- a/bigbluebutton-html5/imports/api/audio-captions/server/handlers/transcriptUpdated.js +++ b/bigbluebutton-html5/imports/api/audio-captions/server/handlers/transcriptUpdated.js @@ -1,26 +1,14 @@ import setTranscript from '/imports/api/audio-captions/server/modifiers/setTranscript'; -import updatePad from '/imports/api/pads/server/methods/updatePad'; -import Users from '/imports/api/users'; export default function transcriptUpdated({ header, body }) { const { meetingId, - userId, } = header; const { transcriptId, transcript, - locale, - result, } = body; - if (result) { - const user = Users.findOne({ userId }, { fields: { name: 1 } }); - const datetime = new Date(Date.now()); - const userSpoke = `\n ${user.name} (${datetime.getHours()}:${datetime.getMinutes()}): ${transcript}`; - updatePad(meetingId, userId, 'en', userSpoke); - } - setTranscript(meetingId, transcriptId, transcript); } diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx index 9b5aa82ea8..084932c544 100755 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx @@ -1,4 +1,5 @@ import React, { PureComponent } from 'react'; +import CaptionsButtonContainer from '/imports/ui/components/captions/button/container'; import withShortcutHelper from '/imports/ui/components/shortcut-help/service'; import deviceInfo from '/imports/utils/deviceInfo'; import Styled from './styles'; @@ -67,6 +68,11 @@ class ActionsBar extends PureComponent { showPushLayout, }} /> + { isCaptionsAvailable + ? ( + + ) + : null } { !deviceInfo.isMobile ? ( diff --git a/bigbluebutton-html5/imports/ui/components/audio/captions/button/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/captions/button/component.jsx index c8fe1209a9..326bd995b3 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/captions/button/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/captions/button/component.jsx @@ -3,11 +3,9 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import Service from '/imports/ui/components/audio/captions/service'; import SpeechService from '/imports/ui/components/audio/captions/speech/service'; -import ServiceOldCaptions from '/imports/ui/components/captions/service'; import ButtonEmoji from '/imports/ui/components/common/button/button-emoji/ButtonEmoji'; import BBBMenu from '/imports/ui/components/common/menu/component'; import Styled from './styles'; -import OldCaptionsService from '/imports/ui/components/captions/service'; const intlMessages = defineMessages({ start: { @@ -90,16 +88,7 @@ const CaptionsButton = ({ availableVoices, isSupported, isVoiceUser, - mountModal, }) => { - const usePrevious = (value) => { - const ref = useRef(); - useEffect(() => { - ref.current = value; - }); - return ref.current; - } - const isTranscriptionDisabled = () => ( currentSpeechLocale === DISABLED ); @@ -115,12 +104,7 @@ const CaptionsButton = ({ if (!isTranscriptionDisabled()) selectedLocale.current = getSelectedLocaleValue; }, [currentSpeechLocale]); - const prevEnabled = usePrevious(enabled); - - if (!enabled) return null; - if (!prevEnabled && enabled) { - OldCaptionsService.createCaptions('en'); - } + if (!enabled) return null; const shouldRenderChevron = isSupported && isVoiceUser; diff --git a/bigbluebutton-html5/imports/ui/components/audio/captions/button/container.jsx b/bigbluebutton-html5/imports/ui/components/audio/captions/button/container.jsx index d5c017afa9..c755ca9a70 100644 --- a/bigbluebutton-html5/imports/ui/components/audio/captions/button/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/captions/button/container.jsx @@ -8,7 +8,7 @@ import AudioService from '/imports/ui/components/audio/service'; const Container = (props) =>