diff --git a/bigbluebutton-html5/imports/api/timer/server/methods.js b/bigbluebutton-html5/imports/api/timer/server/methods.js
index 85be11faa2..9ba7df826b 100644
--- a/bigbluebutton-html5/imports/api/timer/server/methods.js
+++ b/bigbluebutton-html5/imports/api/timer/server/methods.js
@@ -1,5 +1,4 @@
import { Meteor } from 'meteor/meteor';
-import activateTimer from './methods/activateTimer';
import deactivateTimer from './methods/deactivateTimer';
import resetTimer from './methods/resetTimer';
import startTimer from './methods/startTimer';
@@ -11,7 +10,6 @@ import setTrack from './methods/setTrack';
import timerEnded from './methods/endTimer';
Meteor.methods({
- activateTimer,
deactivateTimer,
resetTimer,
startTimer,
diff --git a/bigbluebutton-html5/imports/api/timer/server/methods/activateTimer.js b/bigbluebutton-html5/imports/api/timer/server/methods/activateTimer.js
deleted file mode 100644
index 41cb168caa..0000000000
--- a/bigbluebutton-html5/imports/api/timer/server/methods/activateTimer.js
+++ /dev/null
@@ -1,23 +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';
-import { getInitialState } from '../helpers';
-
-export default function activateTimer() {
- const REDIS_CONFIG = Meteor.settings.private.redis;
- const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
- const EVENT_NAME = 'ActivateTimerReqMsg';
-
- try {
- const { meetingId, requesterUserId } = extractCredentials(this.userId);
- check(meetingId, String);
- check(requesterUserId, String);
-
- const payload = getInitialState();
-
- RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
- } catch (err) {
- Logger.error(`Activating timer: ${err}`);
- }
-}
diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx
index 3f55470ff4..3ae3bd60e9 100755
--- a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx
+++ b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx
@@ -165,9 +165,9 @@ class ActionsDropdown extends PureComponent {
}
handleTimerClick() {
- const { isTimerActive, layoutContextDispatch } = this.props;
+ const { isTimerActive, activateTimer } = this.props;
if (!isTimerActive) {
- TimerService.activateTimer(layoutContextDispatch);
+ activateTimer();
} else {
TimerService.deactivateTimer();
}
diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/container.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/container.jsx
index 97d6d31534..ad3b5198c2 100644
--- a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/container.jsx
+++ b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/container.jsx
@@ -2,7 +2,7 @@ import React, { useContext } from 'react';
import PresentationUploaderService from '/imports/ui/components/presentation/presentation-uploader/service';
import ActionsDropdown from './component';
import { layoutSelectInput, layoutDispatch, layoutSelect } from '../../layout/context';
-import { SMALL_VIEWPORT_BREAKPOINT } from '../../layout/enums';
+import { SMALL_VIEWPORT_BREAKPOINT, ACTIONS, PANELS } from '../../layout/enums';
import { isCameraAsContentEnabled, isTimerFeatureEnabled } from '/imports/ui/services/features';
import { PluginsContext } from '/imports/ui/components/components-data/plugin-context/context';
import { useSubscription, useMutation } from '@apollo/client';
@@ -10,8 +10,12 @@ 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 Auth from '/imports/ui/services/auth';
+const TIMER_CONFIG = Meteor.settings.public.timer;
+const MILLI_IN_MINUTE = 60000;
+
const ActionsDropdownContainer = (props) => {
const sidebarContent = layoutSelectInput((i) => i.sidebarContent);
const sidebarNavigation = layoutSelectInput((i) => i.sidebarNavigation);
@@ -29,11 +33,29 @@ const ActionsDropdownContainer = (props) => {
const presentations = presentationData?.pres_presentation || [];
const [setPresenter] = useMutation(SET_PRESENTER);
+ const [timerActivate] = useMutation(TIMER_ACTIVATE);
const handleTakePresenter = () => {
setPresenter({ variables: { userId: Auth.userID } });
};
+ const activateTimer = () => {
+ const stopwatch = true;
+ const running = false;
+ const time = TIMER_CONFIG.time * MILLI_IN_MINUTE;
+
+ timerActivate({ variables: { stopwatch, running, time } });
+
+ layoutContextDispatch({
+ type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
+ value: true,
+ });
+ layoutContextDispatch({
+ type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
+ value: PANELS.TIMER,
+ });
+ };
+
return (
{
setPresentation: PresentationUploaderService.setPresentation,
isCameraAsContentEnabled: isCameraAsContentEnabled(),
handleTakePresenter,
+ activateTimer,
...props,
}}
/>
diff --git a/bigbluebutton-html5/imports/ui/components/timer/mutations.jsx b/bigbluebutton-html5/imports/ui/components/timer/mutations.jsx
new file mode 100644
index 0000000000..574a0cbcc5
--- /dev/null
+++ b/bigbluebutton-html5/imports/ui/components/timer/mutations.jsx
@@ -0,0 +1,15 @@
+import { gql } from '@apollo/client';
+
+export const TIMER_ACTIVATE = gql`
+ mutation timerActivate($stopwatch: Boolean!, $running: Boolean!, $time: Int!) {
+ timerActivate(
+ stopwatch: $stopwatch,
+ running: $running,
+ time: $time
+ )
+ }
+`;
+
+export default {
+ TIMER_ACTIVATE,
+};
diff --git a/bigbluebutton-html5/imports/ui/components/timer/service.js b/bigbluebutton-html5/imports/ui/components/timer/service.js
index 278e5bdb56..4f723bea16 100644
--- a/bigbluebutton-html5/imports/ui/components/timer/service.js
+++ b/bigbluebutton-html5/imports/ui/components/timer/service.js
@@ -91,26 +91,6 @@ const setTimer = (time) => makeCall('setTimer', time);
const resetTimer = () => makeCall('resetTimer');
-const activateTimer = (layoutContextDispatch) => {
- makeCall('activateTimer');
- //Set an observer to switch to timer tab as soon as the timer is activated
- const handle =Timer.find({ meetingId: Auth.meetingID }).observeChanges({
- changed(id, timer) {
- if (timer.active === true) {
- layoutContextDispatch({
- type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
- value: true,
- });
- layoutContextDispatch({
- type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
- value: PANELS.TIMER,
- });
- }
- handle.stop();
- }
- });
- };
-
const deactivateTimer = () => makeCall('deactivateTimer');
const timerEnded = () => makeCall('timerEnded');
@@ -323,7 +303,6 @@ export default {
setMinutes,
setSeconds,
resetTimer,
- activateTimer,
deactivateTimer,
fetchTimeOffset,
setTrack,