migrate stopPoll meteor call
This commit is contained in:
parent
286da931b3
commit
4806e00192
@ -1,8 +1,6 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import startPoll from './methods/startPoll';
|
||||
import stopPoll from './methods/stopPoll';
|
||||
|
||||
Meteor.methods({
|
||||
startPoll,
|
||||
stopPoll,
|
||||
});
|
||||
|
@ -1,21 +0,0 @@
|
||||
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 stopPoll() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'StopPollReqMsg';
|
||||
|
||||
try {
|
||||
const { meetingId, requesterUserId: requesterId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterId, String);
|
||||
|
||||
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterId, ({ requesterId }));
|
||||
} catch (err) {
|
||||
Logger.error(`Exception while invoking method stopPoll ${err.stack}`);
|
||||
}
|
||||
}
|
@ -1,18 +1,21 @@
|
||||
import React from 'react';
|
||||
import { withTracker } from 'meteor/react-meteor-data';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import { makeCall } from '/imports/ui/services/api';
|
||||
import PollService from '/imports/ui/components/poll/service';
|
||||
import QuickPollDropdown from './component';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import { layoutDispatch } from '../../layout/context';
|
||||
import { POLL_CANCEL } from '/imports/ui/components/poll/mutations';
|
||||
|
||||
const QuickPollDropdownContainer = (props) => {
|
||||
const layoutContextDispatch = layoutDispatch();
|
||||
return <QuickPollDropdown {...{ layoutContextDispatch, ...props }} />;
|
||||
|
||||
const [stopPoll] = useMutation(POLL_CANCEL);
|
||||
|
||||
return <QuickPollDropdown {...{ layoutContextDispatch, stopPoll, ...props }} />;
|
||||
};
|
||||
|
||||
export default withTracker(() => ({
|
||||
activePoll: Session.get('pollInitiated') || false,
|
||||
pollTypes: PollService.pollTypes,
|
||||
stopPoll: () => makeCall('stopPoll'),
|
||||
}))(injectIntl(QuickPollDropdownContainer));
|
||||
|
@ -8,7 +8,7 @@ import Service from './service';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
import { UsersContext } from '../components-data/users-context/context';
|
||||
import { layoutDispatch, layoutSelectInput } from '../layout/context';
|
||||
import { POLL_PUBLISH_RESULT } from './mutations';
|
||||
import { POLL_PUBLISH_RESULT, POLL_CANCEL } from './mutations';
|
||||
|
||||
const CHAT_CONFIG = Meteor.settings.public.chat;
|
||||
const PUBLIC_CHAT_KEY = CHAT_CONFIG.public_id;
|
||||
@ -28,6 +28,7 @@ const PollContainer = ({ ...props }) => {
|
||||
});
|
||||
|
||||
const [pollPublishResult] = useMutation(POLL_PUBLISH_RESULT);
|
||||
const [stopPoll] = useMutation(POLL_CANCEL);
|
||||
|
||||
const publishPoll = (pollId) => {
|
||||
pollPublishResult({
|
||||
@ -39,7 +40,7 @@ const PollContainer = ({ ...props }) => {
|
||||
|
||||
return (
|
||||
<Poll
|
||||
{...{ layoutContextDispatch, sidebarContentPanel, publishPoll, ...props }}
|
||||
{...{ layoutContextDispatch, sidebarContentPanel, publishPoll, stopPoll, ...props }}
|
||||
usernames={usernames}
|
||||
/>
|
||||
);
|
||||
@ -58,15 +59,12 @@ export default withTracker(({ amIPresenter, currentSlideId }) => {
|
||||
|
||||
const startCustomPoll = (type, secretPoll, question = '', isMultipleResponse, answers) => makeCall('startPoll', pollTypes, type, pollId, secretPoll, question, isMultipleResponse, answers);
|
||||
|
||||
const stopPoll = () => makeCall('stopPoll');
|
||||
|
||||
return {
|
||||
isPollSecret,
|
||||
currentSlideId,
|
||||
pollTypes,
|
||||
startPoll,
|
||||
startCustomPoll,
|
||||
stopPoll,
|
||||
currentPoll: Service.currentPoll(),
|
||||
isDefaultPoll: Service.isDefaultPoll,
|
||||
checkPollType: Service.checkPollType,
|
||||
|
@ -26,8 +26,15 @@ export const POLL_SUBMIT_VOTE = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const POLL_CANCEL = gql`
|
||||
mutation PollCancel {
|
||||
pollCancel
|
||||
}
|
||||
`;
|
||||
|
||||
export default {
|
||||
POLL_PUBLISH_RESULT,
|
||||
POLL_SUBMIT_TYPED_VOTE,
|
||||
POLL_SUBMIT_VOTE,
|
||||
POLL_CANCEL,
|
||||
};
|
||||
|
@ -8,8 +8,9 @@ import PresentationToolbarService from './service';
|
||||
import FullscreenService from '/imports/ui/components/common/fullscreen-button/service';
|
||||
import { isPollingEnabled } from '/imports/ui/services/features';
|
||||
import { PluginsContext } from '/imports/ui/components/components-data/plugin-context/context';
|
||||
import { useSubscription } from '@apollo/client';
|
||||
import { useSubscription, useMutation } from '@apollo/client';
|
||||
import POLL_SUBSCRIPTION from '/imports/ui/core/graphql/queries/pollSubscription';
|
||||
import { POLL_CANCEL } from '/imports/ui/components/poll/mutations';
|
||||
|
||||
const PresentationToolbarContainer = (props) => {
|
||||
const pluginsContext = useContext(PluginsContext);
|
||||
@ -22,8 +23,10 @@ const PresentationToolbarContainer = (props) => {
|
||||
|
||||
const handleToggleFullScreen = (ref) => FullscreenService.toggleFullScreen(ref);
|
||||
|
||||
const [stopPoll] = useMutation(POLL_CANCEL);
|
||||
|
||||
const endCurrentPoll = () => {
|
||||
if (hasPoll) makeCall('stopPoll');
|
||||
if (hasPoll) stopPoll();
|
||||
};
|
||||
|
||||
if (userIsPresenter && !layoutSwapped) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { UploadingPresentations } from '/imports/api/presentations';
|
||||
import PresentationUploadToken from '/imports/api/presentation-upload-token';
|
||||
import Auth from '/imports/ui/services/auth';
|
||||
import Poll from '/imports/api/polls/';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { makeCall } from '/imports/ui/services/api';
|
||||
import logger from '/imports/startup/client/logger';
|
||||
@ -189,8 +188,6 @@ const setPresentation = (presentationId) => {
|
||||
};
|
||||
|
||||
const removePresentation = (presentationId) => {
|
||||
const hasPoll = Poll.find({}, { fields: {} }).count();
|
||||
if (hasPoll) makeCall('stopPoll');
|
||||
makeCall('removePresentation', presentationId, POD_ID);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user