[apply-toast-shared-notes] - fix shared-notes display wrong information when clicking the confirm button

This commit is contained in:
GuiLeme 2022-09-27 10:05:27 -03:00
parent 5cb34e7917
commit 9495e9ae01
5 changed files with 15 additions and 3 deletions

View File

@ -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 = {

View File

@ -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})`; }

View File

@ -255,7 +255,7 @@ const renderToastList = (presentations, intl) => {
}
return (
<Styled.ToastWrapper>
<Styled.ToastWrapper data-test="presentationUploadProgressToast" >
<Styled.UploadToastHeader>
<Styled.UploadIcon iconName="upload" />
<Styled.UploadToastTitle>{toastHeading}</Styled.UploadToastTitle>

View File

@ -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,

View File

@ -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,