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.
This commit is contained in:
parent
9cabb69eb8
commit
a76de8c458
@ -1,26 +1,14 @@
|
|||||||
import setTranscript from '/imports/api/audio-captions/server/modifiers/setTranscript';
|
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 }) {
|
export default function transcriptUpdated({ header, body }) {
|
||||||
const {
|
const {
|
||||||
meetingId,
|
meetingId,
|
||||||
userId,
|
|
||||||
} = header;
|
} = header;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
transcriptId,
|
transcriptId,
|
||||||
transcript,
|
transcript,
|
||||||
locale,
|
|
||||||
result,
|
|
||||||
} = body;
|
} = 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);
|
setTranscript(meetingId, transcriptId, transcript);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
|
import CaptionsButtonContainer from '/imports/ui/components/captions/button/container';
|
||||||
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
||||||
import deviceInfo from '/imports/utils/deviceInfo';
|
import deviceInfo from '/imports/utils/deviceInfo';
|
||||||
import Styled from './styles';
|
import Styled from './styles';
|
||||||
@ -67,6 +68,11 @@ class ActionsBar extends PureComponent {
|
|||||||
showPushLayout,
|
showPushLayout,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{ isCaptionsAvailable
|
||||||
|
? (
|
||||||
|
<CaptionsButtonContainer {...{ intl }} />
|
||||||
|
)
|
||||||
|
: null }
|
||||||
{ !deviceInfo.isMobile
|
{ !deviceInfo.isMobile
|
||||||
? (
|
? (
|
||||||
<AudioCaptionsButtonContainer />
|
<AudioCaptionsButtonContainer />
|
||||||
|
@ -3,11 +3,9 @@ import PropTypes from 'prop-types';
|
|||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
import Service from '/imports/ui/components/audio/captions/service';
|
import Service from '/imports/ui/components/audio/captions/service';
|
||||||
import SpeechService from '/imports/ui/components/audio/captions/speech/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 ButtonEmoji from '/imports/ui/components/common/button/button-emoji/ButtonEmoji';
|
||||||
import BBBMenu from '/imports/ui/components/common/menu/component';
|
import BBBMenu from '/imports/ui/components/common/menu/component';
|
||||||
import Styled from './styles';
|
import Styled from './styles';
|
||||||
import OldCaptionsService from '/imports/ui/components/captions/service';
|
|
||||||
|
|
||||||
const intlMessages = defineMessages({
|
const intlMessages = defineMessages({
|
||||||
start: {
|
start: {
|
||||||
@ -90,16 +88,7 @@ const CaptionsButton = ({
|
|||||||
availableVoices,
|
availableVoices,
|
||||||
isSupported,
|
isSupported,
|
||||||
isVoiceUser,
|
isVoiceUser,
|
||||||
mountModal,
|
|
||||||
}) => {
|
}) => {
|
||||||
const usePrevious = (value) => {
|
|
||||||
const ref = useRef();
|
|
||||||
useEffect(() => {
|
|
||||||
ref.current = value;
|
|
||||||
});
|
|
||||||
return ref.current;
|
|
||||||
}
|
|
||||||
|
|
||||||
const isTranscriptionDisabled = () => (
|
const isTranscriptionDisabled = () => (
|
||||||
currentSpeechLocale === DISABLED
|
currentSpeechLocale === DISABLED
|
||||||
);
|
);
|
||||||
@ -115,12 +104,7 @@ const CaptionsButton = ({
|
|||||||
if (!isTranscriptionDisabled()) selectedLocale.current = getSelectedLocaleValue;
|
if (!isTranscriptionDisabled()) selectedLocale.current = getSelectedLocaleValue;
|
||||||
}, [currentSpeechLocale]);
|
}, [currentSpeechLocale]);
|
||||||
|
|
||||||
const prevEnabled = usePrevious(enabled);
|
if (!enabled) return null;
|
||||||
|
|
||||||
if (!enabled) return null;
|
|
||||||
if (!prevEnabled && enabled) {
|
|
||||||
OldCaptionsService.createCaptions('en');
|
|
||||||
}
|
|
||||||
|
|
||||||
const shouldRenderChevron = isSupported && isVoiceUser;
|
const shouldRenderChevron = isSupported && isVoiceUser;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import AudioService from '/imports/ui/components/audio/service';
|
|||||||
|
|
||||||
const Container = (props) => <Button {...props} />;
|
const Container = (props) => <Button {...props} />;
|
||||||
|
|
||||||
export default withModalMounter(withTracker(() => {
|
export default withTracker(() => {
|
||||||
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
||||||
const availableVoices = SpeechService.getSpeechVoices();
|
const availableVoices = SpeechService.getSpeechVoices();
|
||||||
const currentSpeechLocale = SpeechService.getSpeechLocale();
|
const currentSpeechLocale = SpeechService.getSpeechLocale();
|
||||||
@ -23,4 +23,4 @@ export default withModalMounter(withTracker(() => {
|
|||||||
isSupported,
|
isSupported,
|
||||||
isVoiceUser,
|
isVoiceUser,
|
||||||
};
|
};
|
||||||
})(Container));
|
})(Container);
|
||||||
|
@ -11,6 +11,20 @@ const Container = (props) => {
|
|||||||
const { isResizing } = cameraDock;
|
const { isResizing } = cameraDock;
|
||||||
const layoutContextDispatch = layoutDispatch();
|
const layoutContextDispatch = layoutDispatch();
|
||||||
|
|
||||||
|
const { amIModerator } = props;
|
||||||
|
|
||||||
|
if (!amIModerator) {
|
||||||
|
layoutContextDispatch({
|
||||||
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
||||||
|
value: false,
|
||||||
|
});
|
||||||
|
layoutContextDispatch({
|
||||||
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
||||||
|
value: PANELS.NONE,
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return <Captions {...{ layoutContextDispatch, isResizing, ...props }} />;
|
return <Captions {...{ layoutContextDispatch, isResizing, ...props }} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import WriterMenu from './component';
|
|||||||
import { layoutDispatch } from '../../layout/context';
|
import { layoutDispatch } from '../../layout/context';
|
||||||
import Auth from '/imports/ui/services/auth';
|
import Auth from '/imports/ui/services/auth';
|
||||||
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
|
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
|
||||||
import SpeechService from '/imports/ui/components/audio/captions/speech/service';
|
|
||||||
|
|
||||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||||
|
|
||||||
@ -16,11 +15,12 @@ const WriterMenuContainer = (props) => {
|
|||||||
const usingUsersContext = useContext(UsersContext);
|
const usingUsersContext = useContext(UsersContext);
|
||||||
const { users } = usingUsersContext;
|
const { users } = usingUsersContext;
|
||||||
const currentUser = users[Auth.meetingID][Auth.userID];
|
const currentUser = users[Auth.meetingID][Auth.userID];
|
||||||
|
const amIModerator = currentUser.role === ROLE_MODERATOR;
|
||||||
|
|
||||||
return <WriterMenu {...{ layoutContextDispatch, ...props }} />;
|
return amIModerator && <WriterMenu {...{ layoutContextDispatch, ...props }} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withModalMounter(withTracker(({ mountModal }) => ({
|
export default withModalMounter(withTracker(({ mountModal }) => ({
|
||||||
closeModal: () => mountModal(null),
|
closeModal: () => mountModal(null),
|
||||||
availableLocales: SpeechService.getSpeechVoices(),
|
availableLocales: Service.getAvailableLocales(),
|
||||||
}))(WriterMenuContainer));
|
}))(WriterMenuContainer));
|
||||||
|
@ -33,7 +33,7 @@ class UserContent extends PureComponent {
|
|||||||
return (
|
return (
|
||||||
<Styled.Content data-test="userListContent">
|
<Styled.Content data-test="userListContent">
|
||||||
{isChatEnabled() ? <UserMessagesContainer /> : null}
|
{isChatEnabled() ? <UserMessagesContainer /> : null}
|
||||||
<UserCaptionsContainer />
|
{currentUser.role === ROLE_MODERATOR ? <UserCaptionsContainer /> : null}
|
||||||
<UserNotesContainer />
|
<UserNotesContainer />
|
||||||
{showWaitingRoom && currentUser.role === ROLE_MODERATOR
|
{showWaitingRoom && currentUser.role === ROLE_MODERATOR
|
||||||
? (
|
? (
|
||||||
|
@ -145,6 +145,7 @@ class UserOptions extends PureComponent {
|
|||||||
this.captionsId = _.uniqueId('list-item-');
|
this.captionsId = _.uniqueId('list-item-');
|
||||||
|
|
||||||
this.handleCreateBreakoutRoomClick = this.handleCreateBreakoutRoomClick.bind(this);
|
this.handleCreateBreakoutRoomClick = this.handleCreateBreakoutRoomClick.bind(this);
|
||||||
|
this.handleCaptionsClick = this.handleCaptionsClick.bind(this);
|
||||||
this.onCreateBreakouts = this.onCreateBreakouts.bind(this);
|
this.onCreateBreakouts = this.onCreateBreakouts.bind(this);
|
||||||
this.onInvitationUsers = this.onInvitationUsers.bind(this);
|
this.onInvitationUsers = this.onInvitationUsers.bind(this);
|
||||||
this.renderMenuItems = this.renderMenuItems.bind(this);
|
this.renderMenuItems = this.renderMenuItems.bind(this);
|
||||||
@ -195,6 +196,11 @@ class UserOptions extends PureComponent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleCaptionsClick() {
|
||||||
|
const { mountModal } = this.props;
|
||||||
|
mountModal(<CaptionsWriterMenu />);
|
||||||
|
}
|
||||||
|
|
||||||
renderMenuItems() {
|
renderMenuItems() {
|
||||||
const {
|
const {
|
||||||
intl,
|
intl,
|
||||||
@ -295,6 +301,17 @@ class UserOptions extends PureComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (amIModerator && CaptionsService.isCaptionsEnabled()) {
|
||||||
|
this.menuItems.push({
|
||||||
|
icon: 'closed_caption',
|
||||||
|
label: intl.formatMessage(intlMessages.captionsLabel),
|
||||||
|
description: intl.formatMessage(intlMessages.captionsDesc),
|
||||||
|
key: this.captionsId,
|
||||||
|
onClick: this.handleCaptionsClick,
|
||||||
|
dataTest: 'writeClosedCaptions',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (amIModerator) {
|
if (amIModerator) {
|
||||||
if (isLearningDashboardEnabled()) {
|
if (isLearningDashboardEnabled()) {
|
||||||
this.menuItems.push({
|
this.menuItems.push({
|
||||||
|
Loading…
Reference in New Issue
Block a user