migrate deactivateTimer action

This commit is contained in:
Ramón Souza 2024-01-16 13:51:36 -03:00
parent 05225427a2
commit 0120548528
6 changed files with 12 additions and 29 deletions

View File

@ -1,5 +1,4 @@
import { Meteor } from 'meteor/meteor'; import { Meteor } from 'meteor/meteor';
import deactivateTimer from './methods/deactivateTimer';
import resetTimer from './methods/resetTimer'; import resetTimer from './methods/resetTimer';
import startTimer from './methods/startTimer'; import startTimer from './methods/startTimer';
import stopTimer from './methods/stopTimer'; import stopTimer from './methods/stopTimer';
@ -10,7 +9,6 @@ import setTrack from './methods/setTrack';
import timerEnded from './methods/endTimer'; import timerEnded from './methods/endTimer';
Meteor.methods({ Meteor.methods({
deactivateTimer,
resetTimer, resetTimer,
startTimer, startTimer,
stopTimer, stopTimer,

View File

@ -1,20 +0,0 @@
import { check } from 'meteor/check';
import RedisPubSub from '/imports/startup/server/redis';
import Logger from '/imports/startup/server/logger';
import { extractCredentials } from '/imports/api/common/server/helpers';
export default function deactivateTimer() {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'DeactivateTimerReqMsg';
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, {});
} catch (err) {
Logger.error(`Deactivating timer: ${err}`);
}
}

View File

@ -8,7 +8,6 @@ import LayoutModalContainer from '/imports/ui/components/layout/modal/container'
import BBBMenu from '/imports/ui/components/common/menu/component'; import BBBMenu from '/imports/ui/components/common/menu/component';
import { ActionButtonDropdownItemType } from 'bigbluebutton-html-plugin-sdk/dist/cjs/extensible-areas/action-button-dropdown-item/enums'; import { ActionButtonDropdownItemType } from 'bigbluebutton-html-plugin-sdk/dist/cjs/extensible-areas/action-button-dropdown-item/enums';
import Styled from './styles'; import Styled from './styles';
import TimerService from '/imports/ui/components/timer/service';
import { colorPrimary } from '/imports/ui/stylesheets/styled-components/palette'; import { colorPrimary } from '/imports/ui/stylesheets/styled-components/palette';
import { PANELS, ACTIONS, LAYOUT_TYPE } from '../../layout/enums'; import { PANELS, ACTIONS, LAYOUT_TYPE } from '../../layout/enums';
import { uniqueId } from '/imports/utils/string-utils'; import { uniqueId } from '/imports/utils/string-utils';
@ -165,11 +164,11 @@ class ActionsDropdown extends PureComponent {
} }
handleTimerClick() { handleTimerClick() {
const { isTimerActive, activateTimer } = this.props; const { isTimerActive, activateTimer, deactivateTimer } = this.props;
if (!isTimerActive) { if (!isTimerActive) {
activateTimer(); activateTimer();
} else { } else {
TimerService.deactivateTimer(); deactivateTimer();
} }
} }

View File

@ -10,7 +10,7 @@ import {
PROCESSED_PRESENTATIONS_SUBSCRIPTION, PROCESSED_PRESENTATIONS_SUBSCRIPTION,
} from '/imports/ui/components/whiteboard/queries'; } from '/imports/ui/components/whiteboard/queries';
import { SET_PRESENTER } from '/imports/ui/core/graphql/mutations/userMutations'; import { SET_PRESENTER } from '/imports/ui/core/graphql/mutations/userMutations';
import { TIMER_ACTIVATE } from '../../timer/mutations'; import { TIMER_ACTIVATE, TIMER_DEACTIVATE } from '../../timer/mutations';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
const TIMER_CONFIG = Meteor.settings.public.timer; const TIMER_CONFIG = Meteor.settings.public.timer;
@ -34,6 +34,7 @@ const ActionsDropdownContainer = (props) => {
const [setPresenter] = useMutation(SET_PRESENTER); const [setPresenter] = useMutation(SET_PRESENTER);
const [timerActivate] = useMutation(TIMER_ACTIVATE); const [timerActivate] = useMutation(TIMER_ACTIVATE);
const [timerDeactivate] = useMutation(TIMER_DEACTIVATE);
const handleTakePresenter = () => { const handleTakePresenter = () => {
setPresenter({ variables: { userId: Auth.userID } }); setPresenter({ variables: { userId: Auth.userID } });
@ -72,6 +73,7 @@ const ActionsDropdownContainer = (props) => {
isCameraAsContentEnabled: isCameraAsContentEnabled(), isCameraAsContentEnabled: isCameraAsContentEnabled(),
handleTakePresenter, handleTakePresenter,
activateTimer, activateTimer,
deactivateTimer: timerDeactivate,
...props, ...props,
}} }}
/> />

View File

@ -10,6 +10,13 @@ export const TIMER_ACTIVATE = gql`
} }
`; `;
export const TIMER_DEACTIVATE = gql`
mutation timerDeactivate {
timerDeactivate
}
`;
export default { export default {
TIMER_ACTIVATE, TIMER_ACTIVATE,
TIMER_DEACTIVATE,
}; };

View File

@ -91,8 +91,6 @@ const setTimer = (time) => makeCall('setTimer', time);
const resetTimer = () => makeCall('resetTimer'); const resetTimer = () => makeCall('resetTimer');
const deactivateTimer = () => makeCall('deactivateTimer');
const timerEnded = () => makeCall('timerEnded'); const timerEnded = () => makeCall('timerEnded');
const setTrack = (track) => { const setTrack = (track) => {
@ -303,7 +301,6 @@ export default {
setMinutes, setMinutes,
setSeconds, setSeconds,
resetTimer, resetTimer,
deactivateTimer,
fetchTimeOffset, fetchTimeOffset,
setTrack, setTrack,
getTimeOffset, getTimeOffset,