migrate setBreakoutsTime action

This commit is contained in:
Ramón Souza 2024-01-15 16:50:37 -03:00
parent 87a81e27a9
commit e202dc7082
5 changed files with 17 additions and 44 deletions

View File

@ -1,8 +1,6 @@
import { Meteor } from 'meteor/meteor';
import requestJoinURL from './methods/requestJoinURL';
import setBreakoutsTime from '/imports/api/breakouts/server/methods/setBreakoutsTime';
Meteor.methods({
requestJoinURL,
setBreakoutsTime,
});

View File

@ -1,28 +0,0 @@
import { Meteor } from 'meteor/meteor';
import RedisPubSub from '/imports/startup/server/redis';
import { extractCredentials } from '/imports/api/common/server/helpers';
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
export default function setBreakoutsTime({ timeInMinutes }) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'UpdateBreakoutRoomsTimeReqMsg';
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);
RedisPubSub.publishUserMessage(
CHANNEL, EVENT_NAME, meetingId, requesterUserId,
{
meetingId,
timeInMinutes,
},
);
} catch (err) {
Logger.error(`Exception while invoking method setBreakoutsTime ${err.stack}`);
}
}

View File

@ -12,7 +12,7 @@ import {
} from '/imports/ui/components/audio/audio-modal/service';
import { makeCall } from '/imports/ui/services/api';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import { BREAKOUT_ROOM_END_ALL } from './mutations';
import { BREAKOUT_ROOM_END_ALL, BREAKOUT_ROOM_SET_TIME } from './mutations';
import logger from '/imports/startup/client/logger';
const BreakoutContainer = (props) => {
@ -26,15 +26,23 @@ const BreakoutContainer = (props) => {
const isRTL = layoutSelect((i) => i.isRTL);
const [breakoutRoomEndAll] = useMutation(BREAKOUT_ROOM_END_ALL);
const [breakoutRoomSetTime] = useMutation(BREAKOUT_ROOM_SET_TIME);
const endAllBreakouts = () => {
Service.setCapturedContentUploading();
breakoutRoomEndAll();
};
const setBreakoutsTime = (timeInMinutes) => {
if (timeInMinutes <= 0) return false;
return breakoutRoomSetTime({ variables: { timeInMinutes } });
};
return <BreakoutComponent
amIPresenter={amIPresenter}
endAllBreakouts={endAllBreakouts}
setBreakoutsTime={setBreakoutsTime}
{...{ layoutContextDispatch, isRTL, amIModerator, ...props }}
/>;
};
@ -42,7 +50,6 @@ const BreakoutContainer = (props) => {
export default withTracker((props) => {
const {
requestJoinURL,
setBreakoutsTime,
isNewTimeHigherThanMeetingRemaining,
findBreakouts,
getBreakoutRoomUrl,
@ -90,7 +97,6 @@ export default withTracker((props) => {
...props,
breakoutRooms,
requestJoinURL,
setBreakoutsTime,
isNewTimeHigherThanMeetingRemaining,
getBreakoutRoomUrl,
transferUserToMeeting,

View File

@ -48,6 +48,14 @@ export const BREAKOUT_ROOM_SEND_MESSAGE_TO_ALL = gql`
}
`;
export const BREAKOUT_ROOM_SET_TIME = gql`
mutation BreakoutRoomSetTime($timeInMinutes: Int!) {
breakoutRoomSetTime(
timeInMinutes: $timeInMinutes,
)
}
`;
export default {
BREAKOUT_ROOM_CREATE,
BREAKOUT_ROOM_END_ALL,

View File

@ -96,16 +96,6 @@ const isNewTimeHigherThanMeetingRemaining = (newTimeInMinutes) => {
return false;
};
const setBreakoutsTime = (timeInMinutes) => {
if (timeInMinutes <= 0) return false;
makeCall('setBreakoutsTime', {
timeInMinutes,
});
return true;
};
const transferUserToMeeting = (fromMeetingId, toMeetingId) =>
makeCall('transferUser', fromMeetingId, toMeetingId);
@ -204,7 +194,6 @@ const isUserInBreakoutRoom = (joinedUsers) => {
export default {
findBreakouts,
setBreakoutsTime,
isNewTimeHigherThanMeetingRemaining,
requestJoinURL,
getBreakoutRoomUrl,