From 4ca3d173939df41fe2a654be0c5ccec452361e00 Mon Sep 17 00:00:00 2001 From: Ramon Souza Date: Fri, 11 Jun 2021 16:33:15 -0300 Subject: [PATCH 1/2] check for presenter status at presentation upload modal --- .../presentation-uploader/component.jsx | 8 ++++++-- .../presentation-uploader/container.jsx | 17 ++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx index 5b331f3636..671a425a9b 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx @@ -295,6 +295,10 @@ class PresentationUploader extends Component { } } + componentWillUnmount() { + Session.set('showUploadPresentationView', false); + } + isDefault(presentation) { const { defaultFileName } = this.props; return presentation.filename === defaultFileName @@ -312,8 +316,8 @@ class PresentationUploader extends Component { const validExtentions = fileValidMimeTypes.map((fileValid) => fileValid.extension); const [accepted, rejected] = _.partition(files .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 id = _.uniqueId(file.name); diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/container.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/container.jsx index 0fac2c8ad5..3ea7d6e4e4 100644 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/container.jsx @@ -4,21 +4,22 @@ import { withTracker } from 'meteor/react-meteor-data'; import ErrorBoundary from '/imports/ui/components/error-boundary/component'; import FallbackModal from '/imports/ui/components/fallback-errors/fallback-modal/component'; import Service from './service'; -import PresentationService from '../service'; import PresentationUploader from './component'; +import { withUsersConsumer } from '/imports/ui/components/components-data/users-context/context'; +import Auth from '/imports/ui/services/auth'; const PRESENTATION_CONFIG = Meteor.settings.public.presentation; const PresentationUploaderContainer = (props) => ( props.isPresenter && ( - }> - - + }> + + ) ); -export default withTracker(() => { +export default withUsersConsumer(withTracker(({ users }) => { const currentPresentations = Service.getPresentations(); const { dispatchDisableDownloadable, @@ -26,6 +27,8 @@ export default withTracker(() => { dispatchTogglePresentationDownloadable, } = Service; + const currentUser = users[Auth.meetingID][Auth.userID]; + return { presentations: currentPresentations, defaultFileName: PRESENTATION_CONFIG.defaultPresentationFile, @@ -41,6 +44,6 @@ export default withTracker(() => { dispatchTogglePresentationDownloadable, isOpen: Session.get('showUploadPresentationView') || false, selectedToBeNextCurrent: Session.get('selectedToBeNextCurrent') || null, - isPresenter: PresentationService.isPresenter('DEFAULT_PRESENTATION_POD'), + isPresenter: currentUser.presenter, }; -})(PresentationUploaderContainer); +})(PresentationUploaderContainer)); From 8da630da03ac59a04610190f2619829fea9fded2 Mon Sep 17 00:00:00 2001 From: Ramon Souza Date: Mon, 14 Jun 2021 09:55:18 -0300 Subject: [PATCH 2/2] fix presentation service isPresenter --- .../presentation-uploader/container.jsx | 11 ++++------- .../ui/components/presentation/service.js | 17 ++++++----------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/container.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/container.jsx index 3ea7d6e4e4..b8d4421f5d 100644 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/container.jsx @@ -4,9 +4,8 @@ import { withTracker } from 'meteor/react-meteor-data'; import ErrorBoundary from '/imports/ui/components/error-boundary/component'; import FallbackModal from '/imports/ui/components/fallback-errors/fallback-modal/component'; import Service from './service'; +import PresentationService from '../service'; import PresentationUploader from './component'; -import { withUsersConsumer } from '/imports/ui/components/components-data/users-context/context'; -import Auth from '/imports/ui/services/auth'; const PRESENTATION_CONFIG = Meteor.settings.public.presentation; @@ -19,7 +18,7 @@ const PresentationUploaderContainer = (props) => ( ) ); -export default withUsersConsumer(withTracker(({ users }) => { +export default withTracker(() => { const currentPresentations = Service.getPresentations(); const { dispatchDisableDownloadable, @@ -27,8 +26,6 @@ export default withUsersConsumer(withTracker(({ users }) => { dispatchTogglePresentationDownloadable, } = Service; - const currentUser = users[Auth.meetingID][Auth.userID]; - return { presentations: currentPresentations, defaultFileName: PRESENTATION_CONFIG.defaultPresentationFile, @@ -44,6 +41,6 @@ export default withUsersConsumer(withTracker(({ users }) => { dispatchTogglePresentationDownloadable, isOpen: Session.get('showUploadPresentationView') || false, selectedToBeNextCurrent: Session.get('selectedToBeNextCurrent') || null, - isPresenter: currentUser.presenter, + isPresenter: PresentationService.isPresenter('DEFAULT_PRESENTATION_POD'), }; -})(PresentationUploaderContainer)); +})(PresentationUploaderContainer); diff --git a/bigbluebutton-html5/imports/ui/components/presentation/service.js b/bigbluebutton-html5/imports/ui/components/presentation/service.js index bf3ee75866..5c82cda4af 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/service.js +++ b/bigbluebutton-html5/imports/ui/components/presentation/service.js @@ -155,17 +155,12 @@ const parseCurrentSlideContent = (yesValue, noValue, abstentionValue, trueValue, }; const isPresenter = (podId) => { - // a main presenter in the meeting always owns a default pod - if (podId !== 'DEFAULT_PRESENTATION_POD') { - // if a pod is not default, then we check whether this user owns a current pod - const selector = { - meetingId: Auth.meetingID, - podId, - }; - const pod = PresentationPods.findOne(selector); - return pod.currentPresenterId === Auth.userID; - } - return true; + const selector = { + meetingId: Auth.meetingID, + podId, + }; + const pod = PresentationPods.findOne(selector); + return pod?.currentPresenterId === Auth.userID; }; export default {