[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(meetingId, String);
check(requesterUserId, String); check(requesterUserId, String);
check(downloadable, Boolean); check(downloadable, Match.Maybe(Boolean));
check(presentationId, String); check(presentationId, String);
const payload = { const payload = {

View File

@ -11,7 +11,7 @@ async function convertAndUpload() {
let filename = 'Shared_Notes'; let filename = 'Shared_Notes';
const presentations = PresentationUploaderService.getPresentations(); 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})`; } if (duplicates !== 0) { filename = `${filename}(${duplicates})`; }

View File

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

View File

@ -329,6 +329,14 @@ class PresentationUploader extends Component {
const { presentations: prevPropPresentations } = prevProps; const { presentations: prevPropPresentations } = prevProps;
let shouldUpdateState = isOpen && !prevProps.isOpen; 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({ const presState = Object.values({
...propPresentations, ...propPresentations,
...presentations, ...presentations,

View File

@ -49,6 +49,8 @@ const getPresentations = () => Presentations
current, current,
downloadable, downloadable,
removable, removable,
renderedInToast,
temporaryPresentationId,
id, id,
name, name,
exportation, exportation,
@ -59,6 +61,8 @@ const getPresentations = () => Presentations
return { return {
id, id,
filename: name, filename: name,
renderedInToast,
temporaryPresentationId,
isCurrent: current || false, isCurrent: current || false,
upload: { done: true, error: false }, upload: { done: true, error: false },
isDownloadable: downloadable, isDownloadable: downloadable,