From 421717a8170eb741421b73167e9b3af8c415abe2 Mon Sep 17 00:00:00 2001 From: GuiLeme Date: Tue, 21 Feb 2023 08:41:05 -0300 Subject: [PATCH] [issue-16734] - patch for error handling --- ...sentationAreaDisabledErrorPubMsgHdlr.scala | 43 +++++++++++++++++++ .../PresentationPodHdlrs.scala | 3 +- .../senders/ReceivedJsonMsgHandlerActor.scala | 2 + .../core/running/MeetingActor.scala | 1 + .../common2/msgs/PresentationPodsMsgs.scala | 21 +++++++++ .../org/bigbluebutton/api/MeetingService.java | 16 +++---- .../api/ParamsProcessorUtil.java | 5 --- .../DocumentConversionService.java | 2 + .../DocumentConversionServiceImp.java | 6 +++ .../imp/SlidesGenerationProgressNotifier.java | 10 +++++ .../messages/PresentationAreaDisabled.java | 22 ++++++++++ .../bigbluebutton/api2/BbbWebApiGWApp.scala | 3 ++ .../org/bigbluebutton/api2/MsgBuilder.scala | 15 +++++++ .../api/presentations/server/eventHandlers.js | 1 + .../handlers/presentationConversionUpdate.js | 6 ++- .../presentation-uploader-toast/component.jsx | 6 +++ bigbluebutton-html5/public/locales/en.json | 1 + .../controllers/PresentationController.groovy | 20 +++++---- .../web/services/PresentationService.groovy | 7 +++ 19 files changed, 165 insertions(+), 25 deletions(-) create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationAreaDisabledErrorPubMsgHdlr.scala create mode 100644 bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/PresentationAreaDisabled.java diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationAreaDisabledErrorPubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationAreaDisabledErrorPubMsgHdlr.scala new file mode 100644 index 0000000000..30961b3402 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationAreaDisabledErrorPubMsgHdlr.scala @@ -0,0 +1,43 @@ +package org.bigbluebutton.core.apps.presentationpod + +import org.bigbluebutton.common2.msgs.{ BbbClientMsgHeader, BbbCommonEnvCoreMsg, BbbCoreEnvelope, MessageTypes, PresentationAreaDisabledErrorSysPubMsg, PresentationAreaDisabledErrorEvtMsg, PresentationAreaDisabledErrorEvtMsgBody, Routing } +import org.bigbluebutton.core.bus.MessageBus +import org.bigbluebutton.core.domain.MeetingState2x +import org.bigbluebutton.core.running.LiveMeeting + +trait PresentationAreaDisabledErrorPubMsgHdlr { + + this: PresentationPodHdlrs => + + def handle( + msg: PresentationAreaDisabledErrorSysPubMsg, state: MeetingState2x, + liveMeeting: LiveMeeting, bus: MessageBus + ): MeetingState2x = { + + def broadcastEvent(msg: PresentationAreaDisabledErrorSysPubMsg): Unit = { + + val routing = Routing.addMsgToClientRouting( + MessageTypes.BROADCAST_TO_MEETING, + liveMeeting.props.meetingProp.intId, msg.header.userId + ) + val envelope = BbbCoreEnvelope(PresentationAreaDisabledErrorEvtMsg.NAME, routing) + val header = BbbClientMsgHeader( + PresentationAreaDisabledErrorEvtMsg.NAME, + liveMeeting.props.meetingProp.intId, msg.header.userId + ) + + val body = PresentationAreaDisabledErrorEvtMsgBody( + msg.body.meetingId, + msg.body.presentationName, msg.body.temporaryPresentationId, msg.body.messageKey, + msg.body.message + ) + + val event = PresentationAreaDisabledErrorEvtMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + bus.outGW.send(msgEvent) + } + + broadcastEvent(msg) + state + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala index c35fdf7976..27da9e5c5e 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala @@ -27,7 +27,8 @@ class PresentationPodHdlrs(implicit val context: ActorContext) with PresentationPageConversionStartedSysMsgHdlr with PresentationConversionEndedSysMsgHdlr with PresentationUploadedFileTimeoutErrorPubMsgHdlr - with PresentationHasInvalidMimeTypeErrorPubMsgHdlr { + with PresentationHasInvalidMimeTypeErrorPubMsgHdlr + with PresentationAreaDisabledErrorPubMsgHdlr { val log = Logging(context.system, getClass) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index edfee4f9d3..cf32665489 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -290,6 +290,8 @@ class ReceivedJsonMsgHandlerActor( routeGenericMsg[PresentationUploadedFileTooLargeErrorSysPubMsg](envelope, jsonNode) case PresentationHasInvalidMimeTypeErrorSysPubMsg.NAME => routeGenericMsg[PresentationHasInvalidMimeTypeErrorSysPubMsg](envelope, jsonNode) + case PresentationAreaDisabledErrorSysPubMsg.NAME => + routeGenericMsg[PresentationAreaDisabledErrorSysPubMsg](envelope, jsonNode) case PresentationUploadedFileTimeoutErrorSysPubMsg.NAME => routeGenericMsg[PresentationUploadedFileTimeoutErrorSysPubMsg](envelope, jsonNode) case PresentationConversionUpdateSysPubMsg.NAME => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index c7b3032cbd..1ee573d45c 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -523,6 +523,7 @@ class MeetingActor( case m: PresentationConversionUpdateSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) case m: PresentationUploadedFileTooLargeErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) case m: PresentationHasInvalidMimeTypeErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: PresentationAreaDisabledErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) case m: PresentationUploadedFileTimeoutErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) case m: PresentationPageGeneratedSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) case m: PresentationPageCountErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala index a609bf8b13..87bf4e7d37 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala @@ -183,6 +183,20 @@ case class PresentationHasInvalidMimeTypeErrorSysPubMsgBody( ) +object PresentationAreaDisabledErrorSysPubMsg { val NAME = "PresentationAreaDisabledErrorSysPubMsg" } +case class PresentationAreaDisabledErrorSysPubMsg( + header: BbbClientMsgHeader, + body: PresentationAreaDisabledErrorSysPubMsgBody +) extends StandardMsg +case class PresentationAreaDisabledErrorSysPubMsgBody( + meetingId: String, + presentationName: String, + temporaryPresentationId: String, + messageKey: String, + message: String, +) + + object PresentationUploadedFileTimeoutErrorSysPubMsg { val NAME = "PresentationUploadedFileTimeoutErrorSysPubMsg" } case class PresentationUploadedFileTimeoutErrorSysPubMsg( header: BbbClientMsgHeader, @@ -261,6 +275,13 @@ case class PresentationHasInvalidMimeTypeErrorEvtMsgBody(podId: String, meetingI messageKey: String, fileMime: String, fileExtension: String, ) +object PresentationAreaDisabledErrorEvtMsg { val NAME = "PresentationAreaDisabledErrorEvtMsg" } +case class PresentationAreaDisabledErrorEvtMsg(header: BbbClientMsgHeader, body: PresentationAreaDisabledErrorEvtMsgBody) extends BbbCoreMsg +case class PresentationAreaDisabledErrorEvtMsgBody( meetingId: String, presentationName: String, + temporaryPresentationId: String, messageKey: String, + message: String, + ) + object PresentationUploadedFileTimeoutErrorEvtMsg { val NAME = "PresentationUploadedFileTimeoutErrorEvtMsg" } case class PresentationUploadedFileTimeoutErrorEvtMsg(header: BbbClientMsgHeader, body: PresentationUploadedFileTimeoutErrorEvtMsgBody) extends BbbCoreMsg case class PresentationUploadedFileTimeoutErrorEvtMsgBody(podId: String, meetingId: String, presentationName: String, diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java index d19a6a433a..9f9d9b80b9 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java @@ -20,17 +20,8 @@ package org.bigbluebutton.api; import java.io.File; import java.net.URI; -import java.util.AbstractMap; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import java.util.TreeMap; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -549,6 +540,11 @@ public class MeetingService implements MessageListener { return recordingService.isRecordingExist(recordId); } + public boolean isMeetingWithDisabledPresentationArea(String meetingId) { + Meeting m = getMeeting(meetingId); + return m.getDisabledFeatures().contains("presentationArea"); + } + public String getRecordings2x(List idList, List states, Map metadataFilters, String offset, String limit) { Pageable pageable = null; int o = -1; diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java index 35a31a6bfb..8c9f352da5 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java @@ -1063,11 +1063,6 @@ public class ParamsProcessorUtil { return true; } - public boolean isMeetingWithDisabledPresentationArea() { - ArrayList listOfDisabledFeatures = new ArrayList(Arrays.asList(defaultDisabledFeatures.split(","))); - return listOfDisabledFeatures.contains("presentationArea"); - } - public boolean isPostChecksumSame(String apiCall, Map params) { if (StringUtils.isEmpty(securitySalt)) { log.warn("Security is disabled in this service. Make sure this is intentional."); diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionService.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionService.java index 215df16342..30aa7f25c9 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionService.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionService.java @@ -22,4 +22,6 @@ package org.bigbluebutton.presentation; public interface DocumentConversionService { void processDocument(UploadedPresentation pres); void sendDocConversionFailedOnMimeType(UploadedPresentation pres, String fileMime, String fileExtension); + void sendDocConversionFailedOnDisabledPresentationArea(String temporaryPresentationId, String presFilename, + String meetingId, String messageKey, String message); } diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionServiceImp.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionServiceImp.java index 33f5ebf247..9d0dd1ce48 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionServiceImp.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionServiceImp.java @@ -136,6 +136,12 @@ public class DocumentConversionServiceImp implements DocumentConversionService { notifier.sendInvalidMimeTypeMessage(pres, fileMime, fileExtension); } + public void sendDocConversionFailedOnDisabledPresentationArea( + String temporaryPresentationId, String filename, String meetingId, + String messageKey, String message) { + notifier.sendPresentationAreaDisabledMessage(temporaryPresentationId, filename, meetingId, messageKey, message); + } + private void sendDocConversionRequestReceived(UploadedPresentation pres) { if (! pres.isConversionStarted()) { Map logData = new HashMap(); diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SlidesGenerationProgressNotifier.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SlidesGenerationProgressNotifier.java index 08aa68c420..aebff18ea9 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SlidesGenerationProgressNotifier.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SlidesGenerationProgressNotifier.java @@ -64,6 +64,16 @@ public class SlidesGenerationProgressNotifier { ); messagingService.sendDocConversionMsg(invalidMimeType); } + public void sendPresentationAreaDisabledMessage(String temporaryPresentationId, + String filename, String meetingId, + String messageKey, String message) { + PresentationAreaDisabled presentationAreaDisabled = new PresentationAreaDisabled( + temporaryPresentationId, + filename, meetingId, + messageKey, message + ); + messagingService.sendDocConversionMsg(presentationAreaDisabled); + } public void sendUploadFileTimedout(UploadedPresentation pres, int page) { UploadFileTimedoutMessage errorMessage = new UploadFileTimedoutMessage( pres.getPodId(), diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/PresentationAreaDisabled.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/PresentationAreaDisabled.java new file mode 100644 index 0000000000..c6fd96751f --- /dev/null +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/PresentationAreaDisabled.java @@ -0,0 +1,22 @@ +package org.bigbluebutton.presentation.messages; + +public class PresentationAreaDisabled implements IDocConversionMsg{ + + public final String meetingId; + public final String temporaryPresentationId; + public final String filename; + public final String messageKey; + public final String message; + + public PresentationAreaDisabled( String temporaryPresentationId, + String filename, String meetingId, + String messageKey, String message) { + this.meetingId = meetingId; + this.temporaryPresentationId = temporaryPresentationId; + this.filename = filename; + this.message = message; + this.messageKey = messageKey; + + + } +} diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala index 42860858bd..128a4686b3 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala @@ -350,6 +350,9 @@ class BbbWebApiGWApp( } else if (msg.isInstanceOf[DocInvalidMimeType]) { val event = MsgBuilder.buildPresentationHasInvalidMimeType(msg.asInstanceOf[DocInvalidMimeType]) msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event)) + } else if (msg.isInstanceOf[PresentationAreaDisabled]) { + val event = MsgBuilder.buildPresentationAreaDisabled(msg.asInstanceOf[PresentationAreaDisabled]) + msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event)) } } diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala index e6edc6ac42..68d5a103fa 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala @@ -298,6 +298,21 @@ object MsgBuilder { BbbCommonEnvCoreMsg(envelope, req) } + def buildPresentationAreaDisabled(msg: PresentationAreaDisabled): BbbCommonEnvCoreMsg = { + val routing = collection.immutable.HashMap("sender" -> "bbb-web") + val envelope = BbbCoreEnvelope(PresentationAreaDisabledErrorSysPubMsg.NAME, routing) + val header = BbbClientMsgHeader(PresentationAreaDisabledErrorSysPubMsg.NAME, msg.meetingId, "not-used") + + val body = PresentationAreaDisabledErrorSysPubMsgBody( + presentationName = msg.filename, + temporaryPresentationId = msg.temporaryPresentationId, meetingId = msg.meetingId, + messageKey = msg.messageKey, message = msg.message + ) + + val req = PresentationAreaDisabledErrorSysPubMsg(header, body) + BbbCommonEnvCoreMsg(envelope, req) + } + def buildPresentationUploadedFileTimedoutErrorSysMsg(msg: UploadFileTimedoutMessage): BbbCommonEnvCoreMsg = { val routing = collection.immutable.HashMap("sender" -> "bbb-web") val envelope = BbbCoreEnvelope(PresentationUploadedFileTimeoutErrorSysPubMsg.NAME, routing) diff --git a/bigbluebutton-html5/imports/api/presentations/server/eventHandlers.js b/bigbluebutton-html5/imports/api/presentations/server/eventHandlers.js index f85485e302..1de42c6e62 100644 --- a/bigbluebutton-html5/imports/api/presentations/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/presentations/server/eventHandlers.js @@ -12,6 +12,7 @@ RedisPubSub.on('PresentationPageGeneratedEvtMsg', handlePresentationConversionUp RedisPubSub.on('PresentationPageCountErrorEvtMsg', handlePresentationConversionUpdate); RedisPubSub.on('PresentationUploadedFileTimeoutErrorEvtMsg', handlePresentationConversionUpdate); RedisPubSub.on('PresentationHasInvalidMimeTypeErrorEvtMsg', handlePresentationConversionUpdate); +RedisPubSub.on('PresentationAreaDisabledErrorEvtMsg', handlePresentationConversionUpdate); RedisPubSub.on('PresentationConversionUpdateEvtMsg', handlePresentationConversionUpdate); RedisPubSub.on('PresentationUploadedFileTooLargeErrorEvtMsg', handlePresentationConversionUpdate); RedisPubSub.on('PresentationConversionCompletedEvtMsg', handlePresentationAdded); diff --git a/bigbluebutton-html5/imports/api/presentations/server/handlers/presentationConversionUpdate.js b/bigbluebutton-html5/imports/api/presentations/server/handlers/presentationConversionUpdate.js index 88b0c5f4b8..9bbad82332 100755 --- a/bigbluebutton-html5/imports/api/presentations/server/handlers/presentationConversionUpdate.js +++ b/bigbluebutton-html5/imports/api/presentations/server/handlers/presentationConversionUpdate.js @@ -14,6 +14,7 @@ const GENERATED_SLIDE_KEY = 'GENERATED_SLIDE'; const FILE_TOO_LARGE_KEY = 'FILE_TOO_LARGE'; const CONVERSION_TIMEOUT_KEY = "CONVERSION_TIMEOUT"; const IVALID_MIME_TYPE_KEY = "IVALID_MIME_TYPE"; +const PRESENTATION_AREA_DISABLED_KEY = "PRESENTATION_AREA_DISABLED"; const NO_CONTENT = '204'; // const GENERATING_THUMBNAIL_KEY = 'GENERATING_THUMBNAIL'; // const GENERATED_THUMBNAIL_KEY = 'GENERATED_THUMBNAIL'; @@ -32,7 +33,7 @@ export default function handlePresentationConversionUpdate({ body }, meetingId) check(meetingId, String); check(presentationId, Match.Maybe(String)); - check(podId, String); + check(podId, Match.Maybe(String)); check(status, String); check(temporaryPresentationId, Match.Maybe(String)); @@ -56,6 +57,9 @@ export default function handlePresentationConversionUpdate({ body }, meetingId) statusModifier['conversion.error'] = true; statusModifier['conversion.fileMime'] = body.fileMime; statusModifier['conversion.fileExtension'] = body.fileExtension; + case PRESENTATION_AREA_DISABLED_KEY: + statusModifier['conversion.error'] = true; + statusModifier['conversion.message'] = body.message; case OFFICE_DOC_CONVERSION_INVALID_KEY: case PAGE_COUNT_FAILED_KEY: case PAGE_COUNT_EXCEEDED_KEY: diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-toast/presentation-uploader-toast/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/presentation-toast/presentation-uploader-toast/component.jsx index c72b8954a2..7cebae14d9 100644 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-toast/presentation-uploader-toast/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-toast/presentation-uploader-toast/component.jsx @@ -61,6 +61,10 @@ const intlMessages = defineMessages({ id: 'app.presentationUploder.conversion.invalidMimeType', description: 'warns user that the file\'s mime type is not supported or it doesn\'t match the extension', }, + PRESENTATION_AREA_DISABLED: { + id: 'app.presentationUploder.conversion.presentationAreaDisabled', + description: 'warns user that the presentation area is disabled and therefore nothing can be uploaded', + }, PAGE_COUNT_EXCEEDED: { id: 'app.presentationUploder.conversion.pageCountExceeded', description: 'warns the user that the conversion failed because of the page count', @@ -159,6 +163,8 @@ function renderPresentationItemStatus(item, intl) { constraint['0'] = item.conversion.fileExtension; constraint['1'] = item.conversion.fileMime; break; + case 'PRESENTATION_AREA_DISABLED': + break; default: break; } diff --git a/bigbluebutton-html5/public/locales/en.json b/bigbluebutton-html5/public/locales/en.json index 6e9e2ad806..0fcb7f4b0e 100755 --- a/bigbluebutton-html5/public/locales/en.json +++ b/bigbluebutton-html5/public/locales/en.json @@ -281,6 +281,7 @@ "app.presentationUploder.conversion.generatingSvg": "Generating SVG images ...", "app.presentationUploder.conversion.pageCountExceeded": "Number of pages exceeded maximum of {0}", "app.presentationUploder.conversion.invalidMimeType": "Invalid format detected (extension={0}, content type={1})", + "app.presentationUploder.conversion.presentationAreaDisabled": "Presentation area is disabled", "app.presentationUploder.conversion.conversionTimeout": "Slide {0} could not be processed within {1} attempts.", "app.presentationUploder.conversion.officeDocConversionInvalid": "Failed to process office document. Please upload a PDF instead.", "app.presentationUploder.conversion.officeDocConversionFailed": "Failed to process office document. Please upload a PDF instead.", diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy index 799cb458c8..5f57b6fcb1 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy @@ -108,14 +108,6 @@ class PresentationController { return } - if (paramsProcessorUtil.isMeetingWithDisabledPresentationArea()) { - log.error "This meeting has presentationArea as a disabledFeature, it is not possible to upload anything" - response.addHeader("Cache-Control", "no-cache") - response.contentType = 'plain/text' - response.outputStream << 'presentation area in disabled features' - return - } - def meetingId = params.conference if (Util.isMeetingIdValidFormat(meetingId)) { def meeting = meetingService.getNotEndedMeetingWithId(meetingId) @@ -168,6 +160,18 @@ class PresentationController { uploadFailed = true } + if (meetingService.isMeetingWithDisabledPresentationArea(meetingId)) { + log.error "\n\n\n\n\n\n\nThis meeting has presentationArea as a disabledFeature, it is not possible to upload anything" + presentationService.sendDocConversionFailedOnDisabledPresentationArea( + temporaryPresentationId, presFilename, meetingId, "PRESENTATION_AREA_DISABLED", + "Presentation area is disabled for this meeting" + ) + response.addHeader("Cache-Control", "no-cache") + response.contentType = 'plain/text' + response.outputStream << 'presentation area in disabled features' + return + } + if (presFilename == "" || filenameExt == "") { log.debug("Upload failed. Invalid filename " + presOrigFilename) uploadFailReasons.add("invalid_filename") diff --git a/bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/PresentationService.groovy b/bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/PresentationService.groovy index e6c175ec73..7bf7b70172 100755 --- a/bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/PresentationService.groovy +++ b/bigbluebutton-web/grails-app/services/org/bigbluebutton/web/services/PresentationService.groovy @@ -96,6 +96,13 @@ class PresentationService { documentConversionService.sendDocConversionFailedOnMimeType(pres, fileMime, fileExtension) } + def sendDocConversionFailedOnDisabledPresentationArea(String temporaryPresentationId, + String filename, String meetingId, + String messageKey, String message) { + documentConversionService.sendDocConversionFailedOnDisabledPresentationArea( + temporaryPresentationId, filename, meetingId, messageKey, message) + } + def showSvgImage(String conf, String room, String presentationName, String id) { new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar + "svgs" + File.separatorChar + "slide${id}.svg") }