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 deactivateTimer from './methods/deactivateTimer';
import resetTimer from './methods/resetTimer';
import startTimer from './methods/startTimer';
import stopTimer from './methods/stopTimer';
@ -10,7 +9,6 @@ import setTrack from './methods/setTrack';
import timerEnded from './methods/endTimer';
Meteor.methods({
deactivateTimer,
resetTimer,
startTimer,
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 { ActionButtonDropdownItemType } from 'bigbluebutton-html-plugin-sdk/dist/cjs/extensible-areas/action-button-dropdown-item/enums';
import Styled from './styles';
import TimerService from '/imports/ui/components/timer/service';
import { colorPrimary } from '/imports/ui/stylesheets/styled-components/palette';
import { PANELS, ACTIONS, LAYOUT_TYPE } from '../../layout/enums';
import { uniqueId } from '/imports/utils/string-utils';
@ -165,11 +164,11 @@ class ActionsDropdown extends PureComponent {
}
handleTimerClick() {
const { isTimerActive, activateTimer } = this.props;
const { isTimerActive, activateTimer, deactivateTimer } = this.props;
if (!isTimerActive) {
activateTimer();
} else {
TimerService.deactivateTimer();
deactivateTimer();
}
}

View File

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

View File

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

View File

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