Merge pull request #12565 from ramonlsouza/fix-presentation-upload

fix: check for presenter status at presentation upload modal
This commit is contained in:
Anton Georgiev 2021-06-14 17:01:29 -04:00 committed by GitHub
commit 6b2e070786
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 16 deletions

View File

@ -295,6 +295,10 @@ class PresentationUploader extends Component {
} }
} }
componentWillUnmount() {
Session.set('showUploadPresentationView', false);
}
isDefault(presentation) { isDefault(presentation) {
const { defaultFileName } = this.props; const { defaultFileName } = this.props;
return presentation.filename === defaultFileName return presentation.filename === defaultFileName
@ -312,8 +316,8 @@ class PresentationUploader extends Component {
const validExtentions = fileValidMimeTypes.map((fileValid) => fileValid.extension); const validExtentions = fileValidMimeTypes.map((fileValid) => fileValid.extension);
const [accepted, rejected] = _.partition(files const [accepted, rejected] = _.partition(files
.concat(files2), (f) => ( .concat(files2), (f) => (
validMimes.includes(f.type) || validExtentions.includes(`.${f.name.split('.').pop()}`) validMimes.includes(f.type) || validExtentions.includes(`.${f.name.split('.').pop()}`)
)); ));
const presentationsToUpload = accepted.map((file) => { const presentationsToUpload = accepted.map((file) => {
const id = _.uniqueId(file.name); const id = _.uniqueId(file.name);

View File

@ -12,9 +12,9 @@ const PRESENTATION_CONFIG = Meteor.settings.public.presentation;
const PresentationUploaderContainer = (props) => ( const PresentationUploaderContainer = (props) => (
props.isPresenter props.isPresenter
&& ( && (
<ErrorBoundary Fallback={() => <FallbackModal />}> <ErrorBoundary Fallback={() => <FallbackModal />}>
<PresentationUploader {...props} /> <PresentationUploader {...props} />
</ErrorBoundary> </ErrorBoundary>
) )
); );

View File

@ -155,17 +155,12 @@ const parseCurrentSlideContent = (yesValue, noValue, abstentionValue, trueValue,
}; };
const isPresenter = (podId) => { const isPresenter = (podId) => {
// a main presenter in the meeting always owns a default pod const selector = {
if (podId !== 'DEFAULT_PRESENTATION_POD') { meetingId: Auth.meetingID,
// if a pod is not default, then we check whether this user owns a current pod podId,
const selector = { };
meetingId: Auth.meetingID, const pod = PresentationPods.findOne(selector);
podId, return pod?.currentPresenterId === Auth.userID;
};
const pod = PresentationPods.findOne(selector);
return pod.currentPresenterId === Auth.userID;
}
return true;
}; };
export default { export default {