diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/MakePresentationDownloadReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/MakePresentationDownloadReqMsgHdlr.scala index 98cb42044f..04bdd4af3a 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/MakePresentationDownloadReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/MakePresentationDownloadReqMsgHdlr.scala @@ -151,7 +151,7 @@ trait MakePresentationDownloadReqMsgHdlr extends RightsManagementTrait { val annotationCount: Int = storeAnnotationPages.map(_.annotations.size).sum val isOriginalPresentationType = m.body.typeOfExport == "Original" - if (annotationCount > 0 && !isOriginalPresentationType) { + if (!isOriginalPresentationType && annotationCount > 0) { // Send Export Job to Redis val job = buildStoreExportJobInRedisSysMsg(exportJob, liveMeeting) bus.outGW.send(job) @@ -159,7 +159,9 @@ trait MakePresentationDownloadReqMsgHdlr extends RightsManagementTrait { // Send Annotations to Redis val annotations = StoredAnnotations(jobId, presId, storeAnnotationPages) bus.outGW.send(buildStoreAnnotationsInRedisSysMsg(annotations, liveMeeting)) - } else { + } else if (!isOriginalPresentationType && annotationCount == 0) { + log.error("There is no annotations for presentation with Id {}... Ignoring", presId) + } else if (isOriginalPresentationType) { // Return existing uploaded file directly val convertedFileName = currentPres.get.presentationConvertedName val filename = if (convertedFileName == "") currentPres.get.name else convertedFileName diff --git a/bigbluebutton-html5/imports/api/presentations/server/handlers/presentationExport.js b/bigbluebutton-html5/imports/api/presentations/server/handlers/presentationExport.js index 044b25a6bb..1c7d3c239b 100644 --- a/bigbluebutton-html5/imports/api/presentations/server/handlers/presentationExport.js +++ b/bigbluebutton-html5/imports/api/presentations/server/handlers/presentationExport.js @@ -14,7 +14,7 @@ export default async function handlePresentationExport({ body }, meetingId) { check(typeOfExport, Match.Maybe(String)); if (typeOfExport === "Original") { - setOriginalUriDownload(meetingId, presId, fileURI) + await setOriginalUriDownload(meetingId, presId, fileURI) } else { await sendExportedPresentationChatMsg(meetingId, presId, fileURI, typeOfExport); } diff --git a/bigbluebutton-html5/imports/api/presentations/server/methods.js b/bigbluebutton-html5/imports/api/presentations/server/methods.js index 803c417541..a99dbf4052 100644 --- a/bigbluebutton-html5/imports/api/presentations/server/methods.js +++ b/bigbluebutton-html5/imports/api/presentations/server/methods.js @@ -3,12 +3,12 @@ import removePresentation from './methods/removePresentation'; import setPresentationRenderedInToast from './methods/setPresentationRenderedInToast'; import setPresentation from './methods/setPresentation'; import setPresentationDownloadable from './methods/setPresentationDownloadable'; -import exportPresentationToChat from './methods/exportPresentationToChat'; +import exportPresentation from './methods/exportPresentation'; Meteor.methods({ removePresentation, setPresentation, setPresentationDownloadable, - exportPresentationToChat, + exportPresentation, setPresentationRenderedInToast, }); diff --git a/bigbluebutton-html5/imports/api/presentations/server/methods/exportPresentationToChat.js b/bigbluebutton-html5/imports/api/presentations/server/methods/exportPresentation.js similarity index 94% rename from bigbluebutton-html5/imports/api/presentations/server/methods/exportPresentationToChat.js rename to bigbluebutton-html5/imports/api/presentations/server/methods/exportPresentation.js index 66d6aa3b16..ed2edcac29 100644 --- a/bigbluebutton-html5/imports/api/presentations/server/methods/exportPresentationToChat.js +++ b/bigbluebutton-html5/imports/api/presentations/server/methods/exportPresentation.js @@ -7,7 +7,7 @@ import Presentations from '/imports/api/presentations'; const EXPORTING_THRESHOLD_PER_SLIDE = 2500; -export default async function exportPresentationToChat(presentationId, type) { +export default async function exportPresentation(presentationId, type) { const REDIS_CONFIG = Meteor.settings.private.redis; const CHANNEL = REDIS_CONFIG.channels.toAkkaApps; const EVENT_NAME = 'MakePresentationDownloadReqMsg'; @@ -56,6 +56,6 @@ export default async function exportPresentationToChat(presentationId, type) { RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload); } catch (err) { - Logger.error(`Exception while invoking method exportPresentationToChat ${err.stack}`); + Logger.error(`Exception while invoking method exportPresentation ${err.stack}`); } } 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 4eab4efaa2..82e4864fd0 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx @@ -46,7 +46,8 @@ const propTypes = { presentationUploadExternalUrl: PropTypes.string.isRequired, }).isRequired, isPresenter: PropTypes.bool.isRequired, - exportPresentationToChat: PropTypes.func.isRequired, + exportPresentation: PropTypes.func.isRequired, + getHasAnnotations: PropTypes.func.isRequired, }; const defaultProps = { @@ -687,7 +688,7 @@ class PresentationUploader extends Component { handleDownloadingOfPresentation(item, type) { const { - exportPresentationToChat, + exportPresentation, intl, } = this.props; @@ -743,7 +744,7 @@ class PresentationUploader extends Component { } }; - exportPresentationToChat(item.id, observer, type); + exportPresentation(item.id, observer, type); } getPresentationsToShow() { @@ -1003,6 +1004,7 @@ class PresentationUploader extends Component { selectedToBeNextCurrent, allowDownloadable, renderPresentationItemStatus, + getHasAnnotations, } = this.props; const isActualCurrent = selectedToBeNextCurrent @@ -1034,6 +1036,7 @@ class PresentationUploader extends Component { const formattedDownloadAriaLabel = `${formattedDownloadLabel} ${item.filename}`; + const hasAnnotations = getHasAnnotations(item.id); return ( {allowDownloadable ? ( - { dispatchDisableDownloadable, dispatchEnableDownloadable, dispatchTogglePresentationDownloadable, - exportPresentationToChat, + exportPresentation, } = Service; const isOpen = isPresentationEnabled() && (Session.get('showUploadPresentationView') || false); @@ -49,10 +50,11 @@ export default withTracker(() => { dispatchDisableDownloadable, dispatchEnableDownloadable, dispatchTogglePresentationDownloadable, - exportPresentationToChat, + exportPresentation, isOpen, selectedToBeNextCurrent: Session.get('selectedToBeNextCurrent') || null, externalUploadData: Service.getExternalUploadData(), handleFiledrop: Service.handleFiledrop, + getHasAnnotations, }; })(PresentationUploaderContainer); diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/component.jsx index 5c5ecc9315..71dc6b66b9 100644 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/presentation-download-dropdown/component.jsx @@ -51,6 +51,7 @@ class PresentationDownloadDropdown extends PureComponent { isDownloadable, item, closeModal, + hasAnnotations } = this.props; this.menuItems = []; @@ -83,18 +84,20 @@ class PresentationDownloadDropdown extends PureComponent { ); } - this.menuItems.push( - { - key: this.actionsKey[1], - id: 'sendAnnotatedDocument', - dataTest: 'sendAnnotatedDocument', - label: intl.formatMessage(intlMessages.sendAnnotatedDocument), - onClick: () => { - closeModal(); - handleDownloadingOfPresentation("Annotated"); + if (hasAnnotations) { + this.menuItems.push( + { + key: this.actionsKey[1], + id: 'sendAnnotatedDocument', + dataTest: 'sendAnnotatedDocument', + label: intl.formatMessage(intlMessages.sendAnnotatedDocument), + onClick: () => { + closeModal(); + handleDownloadingOfPresentation("Annotated"); + }, }, - }, - ); + ); + } return this.menuItems; } diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js index ea95b026ca..bd8f06a128 100644 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js @@ -378,7 +378,7 @@ const getExternalUploadData = () => { }; }; -const exportPresentationToChat = (presentationId, observer, type) => { +const exportPresentation = (presentationId, observer, type) => { let lastStatus = {}; Tracker.autorun((c) => { @@ -407,7 +407,7 @@ const exportPresentationToChat = (presentationId, observer, type) => { }); }); - makeCall('exportPresentationToChat', presentationId, type); + makeCall('exportPresentation', presentationId, type); }; function handleFiledrop(files, files2, that, intl, intlMessages) { @@ -487,7 +487,7 @@ export default { setPresentation, requestPresentationUploadToken, getExternalUploadData, - exportPresentationToChat, + exportPresentation, uploadAndConvertPresentation, handleFiledrop, }; diff --git a/bigbluebutton-html5/imports/ui/components/whiteboard/service.js b/bigbluebutton-html5/imports/ui/components/whiteboard/service.js index 902b0dee93..59eb26876b 100755 --- a/bigbluebutton-html5/imports/ui/components/whiteboard/service.js +++ b/bigbluebutton-html5/imports/ui/components/whiteboard/service.js @@ -38,6 +38,13 @@ async function handleAddedAnnotation({ Annotations.upsert(query.selector, query.modifier); } +const getHasAnnotations = (presentationId) => { + const ann = Annotations.find( + {}, + ).fetch(); + return ann.filter(a => a.whiteboardId.includes(presentationId)).length > 0; +} + function handleRemovedAnnotation({ meetingId, whiteboardId, userId, shapeId, }) { @@ -388,4 +395,5 @@ export { changeCurrentSlide, notifyNotAllowedChange, notifyShapeNumberExceeded, + getHasAnnotations, };