migrate removePresentation action
This commit is contained in:
parent
b674d8a912
commit
0dcb2bc7a2
@ -1 +0,0 @@
|
|||||||
import './methods';
|
|
@ -1,6 +0,0 @@
|
|||||||
import { Meteor } from 'meteor/meteor';
|
|
||||||
import removePresentation from './methods/removePresentation';
|
|
||||||
|
|
||||||
Meteor.methods({
|
|
||||||
removePresentation,
|
|
||||||
});
|
|
@ -1,28 +0,0 @@
|
|||||||
import RedisPubSub from '/imports/startup/server/redis';
|
|
||||||
import { check } from 'meteor/check';
|
|
||||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
|
||||||
import Logger from '/imports/startup/server/logger';
|
|
||||||
|
|
||||||
export default function removePresentation(presentationId, podId) {
|
|
||||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
||||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
||||||
const EVENT_NAME = 'RemovePresentationPubMsg';
|
|
||||||
|
|
||||||
try {
|
|
||||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
|
||||||
|
|
||||||
check(meetingId, String);
|
|
||||||
check(requesterUserId, String);
|
|
||||||
check(presentationId, String);
|
|
||||||
check(podId, String);
|
|
||||||
|
|
||||||
const payload = {
|
|
||||||
presentationId,
|
|
||||||
podId,
|
|
||||||
};
|
|
||||||
|
|
||||||
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
|
||||||
} catch (err) {
|
|
||||||
Logger.error(`Exception while invoking method removePresentation ${err.stack}`);
|
|
||||||
}
|
|
||||||
}
|
|
@ -52,6 +52,7 @@ class NotesDropdown extends PureComponent {
|
|||||||
amIPresenter,
|
amIPresenter,
|
||||||
presentations,
|
presentations,
|
||||||
setPresentation,
|
setPresentation,
|
||||||
|
removePresentation,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { converterButtonDisabled } = this.state;
|
const { converterButtonDisabled } = this.state;
|
||||||
@ -72,7 +73,7 @@ class NotesDropdown extends PureComponent {
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
this.setConverterButtonDisabled(true);
|
this.setConverterButtonDisabled(true);
|
||||||
setTimeout(() => this.setConverterButtonDisabled(false), DEBOUNCE_TIMEOUT);
|
setTimeout(() => this.setConverterButtonDisabled(false), DEBOUNCE_TIMEOUT);
|
||||||
return Service.convertAndUpload(presentations, setPresentation);
|
return Service.convertAndUpload(presentations, setPresentation, removePresentation);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -6,7 +6,7 @@ import {
|
|||||||
PROCESSED_PRESENTATIONS_SUBSCRIPTION,
|
PROCESSED_PRESENTATIONS_SUBSCRIPTION,
|
||||||
} from '/imports/ui/components/whiteboard/queries';
|
} from '/imports/ui/components/whiteboard/queries';
|
||||||
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
||||||
import { PRESENTATION_SET_CURRENT } from '../../presentation/mutations';
|
import { PRESENTATION_SET_CURRENT, PRESENTATION_REMOVE } from '../../presentation/mutations';
|
||||||
|
|
||||||
const NotesDropdownContainer = ({ ...props }) => {
|
const NotesDropdownContainer = ({ ...props }) => {
|
||||||
const { data: currentUserData } = useCurrentUser((user) => ({
|
const { data: currentUserData } = useCurrentUser((user) => ({
|
||||||
@ -19,12 +19,29 @@ const NotesDropdownContainer = ({ ...props }) => {
|
|||||||
const presentations = presentationData?.pres_presentation || [];
|
const presentations = presentationData?.pres_presentation || [];
|
||||||
|
|
||||||
const [presentationSetCurrent] = useMutation(PRESENTATION_SET_CURRENT);
|
const [presentationSetCurrent] = useMutation(PRESENTATION_SET_CURRENT);
|
||||||
|
const [presentationRemove] = useMutation(PRESENTATION_REMOVE);
|
||||||
|
|
||||||
const setPresentation = (presentationId) => {
|
const setPresentation = (presentationId) => {
|
||||||
presentationSetCurrent({ variables: { presentationId } });
|
presentationSetCurrent({ variables: { presentationId } });
|
||||||
};
|
};
|
||||||
|
|
||||||
return <NotesDropdown {...{ amIPresenter, isRTL, presentations, setPresentation, ...props }} />;
|
const removePresentation = (presentationId) => {
|
||||||
|
presentationRemove({ variables: { presentationId } });
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<NotesDropdown {
|
||||||
|
...{
|
||||||
|
amIPresenter,
|
||||||
|
isRTL,
|
||||||
|
presentations,
|
||||||
|
setPresentation,
|
||||||
|
removePresentation,
|
||||||
|
...props,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NotesDropdownContainer;
|
export default NotesDropdownContainer;
|
||||||
|
@ -7,7 +7,7 @@ import { uniqueId } from '/imports/utils/string-utils';
|
|||||||
|
|
||||||
const PADS_CONFIG = Meteor.settings.public.pads;
|
const PADS_CONFIG = Meteor.settings.public.pads;
|
||||||
|
|
||||||
async function convertAndUpload(presentations, setPresentation) {
|
async function convertAndUpload(presentations, setPresentation, removePresentation) {
|
||||||
let filename = 'Shared_Notes';
|
let filename = 'Shared_Notes';
|
||||||
const duplicates = presentations.filter((pres) => pres.filename?.startsWith(filename) || pres.name?.startsWith(filename)).length;
|
const duplicates = presentations.filter((pres) => pres.filename?.startsWith(filename) || pres.name?.startsWith(filename)).length;
|
||||||
|
|
||||||
@ -52,7 +52,9 @@ async function convertAndUpload(presentations, setPresentation) {
|
|||||||
onUpload: () => { },
|
onUpload: () => { },
|
||||||
onProgress: () => { },
|
onProgress: () => { },
|
||||||
onDone: () => { },
|
onDone: () => { },
|
||||||
}, setPresentation);
|
},
|
||||||
|
setPresentation,
|
||||||
|
removePresentation);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -53,10 +53,19 @@ export const PRESENTATION_SET_CURRENT = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const PRESENTATION_REMOVE = gql`
|
||||||
|
mutation PresentationRemove($presentationId: String!) {
|
||||||
|
presentationRemove(
|
||||||
|
presentationId: $presentationId,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
PRESENTATION_SET_ZOOM,
|
PRESENTATION_SET_ZOOM,
|
||||||
PRESENTATION_SET_WRITERS,
|
PRESENTATION_SET_WRITERS,
|
||||||
PRESENTATION_SET_PAGE,
|
PRESENTATION_SET_PAGE,
|
||||||
PRESENTATION_SET_DOWNLOADABLE,
|
PRESENTATION_SET_DOWNLOADABLE,
|
||||||
PRESENTATION_SET_CURRENT,
|
PRESENTATION_SET_CURRENT,
|
||||||
|
PRESENTATION_REMOVE,
|
||||||
};
|
};
|
||||||
|
@ -584,6 +584,7 @@ class PresentationUploader extends Component {
|
|||||||
presentations: propPresentations,
|
presentations: propPresentations,
|
||||||
dispatchChangePresentationDownloadable,
|
dispatchChangePresentationDownloadable,
|
||||||
setPresentation,
|
setPresentation,
|
||||||
|
removePresentation,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { disableActions, presentations } = this.state;
|
const { disableActions, presentations } = this.state;
|
||||||
const presentationsToSave = presentations;
|
const presentationsToSave = presentations;
|
||||||
@ -611,7 +612,14 @@ class PresentationUploader extends Component {
|
|||||||
|
|
||||||
if (!disableActions) {
|
if (!disableActions) {
|
||||||
Session.set('showUploadPresentationView', false);
|
Session.set('showUploadPresentationView', false);
|
||||||
return handleSave(presentationsToSave, true, {}, propPresentations, setPresentation)
|
return handleSave(
|
||||||
|
presentationsToSave,
|
||||||
|
true,
|
||||||
|
{},
|
||||||
|
propPresentations,
|
||||||
|
setPresentation,
|
||||||
|
removePresentation,
|
||||||
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const hasError = presentations.some((p) => !!p.uploadErrorMsgKey);
|
const hasError = presentations.some((p) => !!p.uploadErrorMsgKey);
|
||||||
if (!hasError) {
|
if (!hasError) {
|
||||||
|
@ -17,7 +17,7 @@ import {
|
|||||||
PRESENTATIONS_SUBSCRIPTION,
|
PRESENTATIONS_SUBSCRIPTION,
|
||||||
} from '/imports/ui/components/whiteboard/queries';
|
} from '/imports/ui/components/whiteboard/queries';
|
||||||
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
||||||
import { PRESENTATION_SET_DOWNLOADABLE, PRESENTATION_SET_CURRENT } from '../mutations';
|
import { PRESENTATION_SET_DOWNLOADABLE, PRESENTATION_SET_CURRENT, PRESENTATION_REMOVE } from '../mutations';
|
||||||
|
|
||||||
const PRESENTATION_CONFIG = Meteor.settings.public.presentation;
|
const PRESENTATION_CONFIG = Meteor.settings.public.presentation;
|
||||||
|
|
||||||
@ -33,6 +33,7 @@ const PresentationUploaderContainer = (props) => {
|
|||||||
|
|
||||||
const [presentationSetDownloadable] = useMutation(PRESENTATION_SET_DOWNLOADABLE);
|
const [presentationSetDownloadable] = useMutation(PRESENTATION_SET_DOWNLOADABLE);
|
||||||
const [presentationSetCurrent] = useMutation(PRESENTATION_SET_CURRENT);
|
const [presentationSetCurrent] = useMutation(PRESENTATION_SET_CURRENT);
|
||||||
|
const [presentationRemove] = useMutation(PRESENTATION_REMOVE);
|
||||||
|
|
||||||
const exportPresentation = (presentationId, fileStateType) => {
|
const exportPresentation = (presentationId, fileStateType) => {
|
||||||
presentationSetDownloadable({
|
presentationSetDownloadable({
|
||||||
@ -58,6 +59,10 @@ const PresentationUploaderContainer = (props) => {
|
|||||||
presentationSetCurrent({ variables: { presentationId } });
|
presentationSetCurrent({ variables: { presentationId } });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const removePresentation = (presentationId) => {
|
||||||
|
presentationRemove({ variables: { presentationId } });
|
||||||
|
};
|
||||||
|
|
||||||
return userIsPresenter && (
|
return userIsPresenter && (
|
||||||
<ErrorBoundary Fallback={FallbackModal}>
|
<ErrorBoundary Fallback={FallbackModal}>
|
||||||
<PresentationUploader
|
<PresentationUploader
|
||||||
@ -67,6 +72,7 @@ const PresentationUploaderContainer = (props) => {
|
|||||||
exportPresentation={exportPresentation}
|
exportPresentation={exportPresentation}
|
||||||
dispatchChangePresentationDownloadable={dispatchChangePresentationDownloadable}
|
dispatchChangePresentationDownloadable={dispatchChangePresentationDownloadable}
|
||||||
setPresentation={setPresentation}
|
setPresentation={setPresentation}
|
||||||
|
removePresentation={removePresentation}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
|
@ -179,15 +179,18 @@ const uploadAndConvertPresentations = (
|
|||||||
p.onUpload, p.onProgress, p.onConversion, p.current,
|
p.onUpload, p.onProgress, p.onConversion, p.current,
|
||||||
)));
|
)));
|
||||||
|
|
||||||
const removePresentation = (presentationId) => {
|
|
||||||
makeCall('removePresentation', presentationId, POD_ID);
|
|
||||||
};
|
|
||||||
|
|
||||||
const removePresentations = (
|
const removePresentations = (
|
||||||
presentationsToRemove,
|
presentationsToRemove,
|
||||||
) => Promise.all(presentationsToRemove.map((p) => removePresentation(p.presentationId, POD_ID)));
|
removePresentation,
|
||||||
|
) => Promise.all(presentationsToRemove.map((p) => removePresentation(p.presentationId)));
|
||||||
|
|
||||||
const persistPresentationChanges = (oldState, newState, uploadEndpoint, setPresentation) => {
|
const persistPresentationChanges = (
|
||||||
|
oldState,
|
||||||
|
newState,
|
||||||
|
uploadEndpoint,
|
||||||
|
setPresentation,
|
||||||
|
removePresentation,
|
||||||
|
) => {
|
||||||
const presentationsToUpload = newState.filter((p) => !p.uploadCompleted);
|
const presentationsToUpload = newState.filter((p) => !p.uploadCompleted);
|
||||||
const presentationsToRemove = oldState.filter((p) => !newState.find((u) => { return u.presentationId === p.presentationId }));
|
const presentationsToRemove = oldState.filter((p) => !newState.find((u) => { return u.presentationId === p.presentationId }));
|
||||||
|
|
||||||
@ -206,7 +209,7 @@ const persistPresentationChanges = (oldState, newState, uploadEndpoint, setPrese
|
|||||||
})
|
})
|
||||||
.then((presentations) => {
|
.then((presentations) => {
|
||||||
if (currentPresentation === undefined) {
|
if (currentPresentation === undefined) {
|
||||||
setPresentation('', POD_ID);
|
setPresentation('');
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,9 +224,9 @@ const persistPresentationChanges = (oldState, newState, uploadEndpoint, setPrese
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
return setPresentation(currentPresentation?.presentationId, POD_ID);
|
return setPresentation(currentPresentation?.presentationId);
|
||||||
})
|
})
|
||||||
.then(removePresentations.bind(null, presentationsToRemove, POD_ID));
|
.then(removePresentations.bind(null, presentationsToRemove, removePresentation));
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSavePresentation = (
|
const handleSavePresentation = (
|
||||||
@ -232,6 +235,7 @@ const handleSavePresentation = (
|
|||||||
newPres = {},
|
newPres = {},
|
||||||
currentPresentations = [],
|
currentPresentations = [],
|
||||||
setPresentation,
|
setPresentation,
|
||||||
|
removePresentation,
|
||||||
) => {
|
) => {
|
||||||
if (!isPresentationEnabled()) {
|
if (!isPresentationEnabled()) {
|
||||||
return null;
|
return null;
|
||||||
@ -254,6 +258,7 @@ const handleSavePresentation = (
|
|||||||
presentations,
|
presentations,
|
||||||
PRESENTATION_CONFIG.uploadEndpoint,
|
PRESENTATION_CONFIG.uploadEndpoint,
|
||||||
setPresentation,
|
setPresentation,
|
||||||
|
removePresentation,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ import '/imports/api/annotations/server';
|
|||||||
import '/imports/api/cursor/server';
|
import '/imports/api/cursor/server';
|
||||||
import '/imports/api/polls/server';
|
import '/imports/api/polls/server';
|
||||||
import '/imports/api/captions/server';
|
import '/imports/api/captions/server';
|
||||||
import '/imports/api/presentations/server';
|
|
||||||
import '/imports/api/presentation-upload-token/server';
|
import '/imports/api/presentation-upload-token/server';
|
||||||
import '/imports/api/breakouts/server';
|
import '/imports/api/breakouts/server';
|
||||||
import '/imports/api/breakouts-history/server';
|
import '/imports/api/breakouts-history/server';
|
||||||
|
Loading…
Reference in New Issue
Block a user