From 9495e9ae01c8f955acc11bb3afd0ee8ad99ba477 Mon Sep 17 00:00:00 2001 From: GuiLeme Date: Tue, 27 Sep 2022 10:05:27 -0300 Subject: [PATCH] [apply-toast-shared-notes] - fix shared-notes display wrong information when clicking the confirm button --- .../server/methods/setPresentationDownloadable.js | 2 +- .../ui/components/notes/converter-button/service.js | 2 +- .../presentation-uploader-toast/component.jsx | 2 +- .../presentation/presentation-uploader/component.jsx | 8 ++++++++ .../presentation/presentation-uploader/service.js | 4 ++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/bigbluebutton-html5/imports/api/presentations/server/methods/setPresentationDownloadable.js b/bigbluebutton-html5/imports/api/presentations/server/methods/setPresentationDownloadable.js index 2eb1abceef..4ccf1e063a 100644 --- a/bigbluebutton-html5/imports/api/presentations/server/methods/setPresentationDownloadable.js +++ b/bigbluebutton-html5/imports/api/presentations/server/methods/setPresentationDownloadable.js @@ -13,7 +13,7 @@ export default function setPresentationDownloadable(presentationId, downloadable check(meetingId, String); check(requesterUserId, String); - check(downloadable, Boolean); + check(downloadable, Match.Maybe(Boolean)); check(presentationId, String); const payload = { diff --git a/bigbluebutton-html5/imports/ui/components/notes/converter-button/service.js b/bigbluebutton-html5/imports/ui/components/notes/converter-button/service.js index 87681fadc2..4513e48368 100644 --- a/bigbluebutton-html5/imports/ui/components/notes/converter-button/service.js +++ b/bigbluebutton-html5/imports/ui/components/notes/converter-button/service.js @@ -11,7 +11,7 @@ async function convertAndUpload() { let filename = 'Shared_Notes'; const presentations = PresentationUploaderService.getPresentations(); - const duplicates = presentations.filter((pres) => pres.filename.startsWith(filename)).length; + const duplicates = presentations.filter((pres) => pres.filename?.startsWith(filename) || pres.name?.startsWith(filename)).length; if (duplicates !== 0) { filename = `${filename}(${duplicates})`; } 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 13679879ab..5eff040937 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 @@ -255,7 +255,7 @@ const renderToastList = (presentations, intl) => { } return ( - + {toastHeading} 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 4f5c33ab92..054bc2185c 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/component.jsx @@ -329,6 +329,14 @@ class PresentationUploader extends Component { const { presentations: prevPropPresentations } = prevProps; let shouldUpdateState = isOpen && !prevProps.isOpen; + + propPresentations.forEach(p => { + const indexOfPres = presentations.findIndex(pres => pres.temporaryPresentationId === p.temporaryPresentationId || pres.filename === p.filename); + if (indexOfPres === -1 && p.renderedInToast !== undefined && !p.renderedInToast) { + shouldUpdateState = true; + } + }) + const presState = Object.values({ ...propPresentations, ...presentations, 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 b50827ebeb..d19a0b7f7b 100644 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-uploader/service.js @@ -49,6 +49,8 @@ const getPresentations = () => Presentations current, downloadable, removable, + renderedInToast, + temporaryPresentationId, id, name, exportation, @@ -59,6 +61,8 @@ const getPresentations = () => Presentations return { id, filename: name, + renderedInToast, + temporaryPresentationId, isCurrent: current || false, upload: { done: true, error: false }, isDownloadable: downloadable,