From c230720c4dfaa6e920ee32f6c26c35bca9dc134f Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Fri, 17 May 2024 18:44:15 +0000 Subject: [PATCH 01/77] fix: Gemfile to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-RUBY-REXML-6861566 --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 751e05d2d32b..6cf346b06332 100644 --- a/Gemfile +++ b/Gemfile @@ -3,9 +3,9 @@ source "https://rubygems.org" # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version ruby ">= 2.6.10" -gem "cocoapods", "~> 1.13" +gem "cocoapods", "~> 1.14", ">= 1.14.0" gem "activesupport", ">= 6.1.7.3", "< 7.1.0" -gem "fastlane", "~> 2" +gem "fastlane", "~> 2", ">= 2.220.0" gem "xcpretty", "~> 0" From 8a279236db386b03d89ea756d64bdde563555513 Mon Sep 17 00:00:00 2001 From: dominictb Date: Wed, 22 May 2024 16:40:01 +0700 Subject: [PATCH 02/77] fix: cache extra attributes for video markdown conversion --- src/libs/actions/Report.ts | 12 +++++++----- .../report/ReportActionItemMessageEdit.tsx | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 91a0ce5da930..8bc996a8b5a1 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -1435,18 +1435,21 @@ function removeLinksFromHtml(html: string, links: string[]): string { * @param newCommentText text of the comment after editing. * @param originalCommentMarkdown original markdown of the comment before editing. */ -function handleUserDeletedLinksInHtml(newCommentText: string, originalCommentMarkdown: string): string { +function handleUserDeletedLinksInHtml(newCommentText: string, originalCommentMarkdown: string, videoAttributeCache?: Record): string { const parser = new ExpensiMark(); if (newCommentText.length > CONST.MAX_MARKUP_LENGTH) { return newCommentText; } - const htmlForNewComment = parser.replace(newCommentText); + + const htmlForNewComment = parser.replace(newCommentText, { + extras: {videoAttributeCache}, + }); const removedLinks = parser.getRemovedMarkdownLinks(originalCommentMarkdown, newCommentText); return removeLinksFromHtml(htmlForNewComment, removedLinks); } /** Saves a new message for a comment. Marks the comment as edited, which will be reflected in the UI. */ -function editReportComment(reportID: string, originalReportAction: OnyxEntry, textForNewComment: string) { +function editReportComment(reportID: string, originalReportAction: OnyxEntry, textForNewComment: string, videoAttributeCache?: Record) { const parser = new ExpensiMark(); const originalReportID = ReportUtils.getOriginalReportID(reportID, originalReportAction); @@ -1464,8 +1467,7 @@ function editReportComment(reportID: string, originalReportAction: OnyxEntry video attributes +const draftMessageVideoAttributeCache = new Map(); + function ReportActionItemMessageEdit( {action, draftMessage, reportID, index, shouldDisableEmojiPicker = false}: ReportActionItemMessageEditProps, forwardedRef: ForwardedRef, @@ -106,7 +109,18 @@ function ReportActionItemMessageEdit( useEffect(() => { const parser = new ExpensiMark(); - const originalMessage = parser.htmlToMarkdown(action.message?.[0]?.html ?? ''); + const videoAttributesCache: Record = {}; + const originalMessage = parser.htmlToMarkdown(action.message?.[0]?.html ?? '', { + cacheVideoAttributes: (videoSource, attrs) => { + videoAttributesCache[videoSource] = attrs; + }, + }); + + draftMessageVideoAttributeCache.clear(); + for (const [videoSource, attrs] of Object.entries(videoAttributesCache)) { + draftMessageVideoAttributeCache.set(videoSource, attrs); + } + if ( ReportActionsUtils.isDeletedAction(action) || Boolean(action.message && draftMessage === originalMessage) || @@ -301,7 +315,7 @@ function ReportActionItemMessageEdit( ReportActionContextMenu.showDeleteModal(reportID, action, true, deleteDraft, () => focusEditAfterCancelDelete(textInputRef.current)); return; } - Report.editReportComment(reportID, action, trimmedNewDraft); + Report.editReportComment(reportID, action, trimmedNewDraft, Object.fromEntries(draftMessageVideoAttributeCache)); deleteDraft(); }, [action, deleteDraft, draft, reportID]); From 27809d61306e002929974fb7bd7e754ab9ee096a Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Fri, 7 Jun 2024 15:15:47 +0530 Subject: [PATCH 03/77] fix: mWeb - Chat - Uploading an image while offline briefly shows an offline message in the preview. Signed-off-by: Krishna Gupta --- src/components/ImageView/index.tsx | 10 ++++++---- src/components/Lightbox/index.tsx | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/ImageView/index.tsx b/src/components/ImageView/index.tsx index f08941ef7d77..da77f93ab65c 100644 --- a/src/components/ImageView/index.tsx +++ b/src/components/ImageView/index.tsx @@ -195,6 +195,8 @@ function ImageView({isAuthTokenRequired = false, url, fileName, onError}: ImageV }; }, [canUseTouchScreen, trackMovement, trackPointerPosition]); + const isLocalFile = url.startsWith('blob:') || url.startsWith('file:'); + if (canUseTouchScreen) { return ( - {((isLoading && !isOffline) || (!isLoading && zoomScale === 0)) && } - {isLoading && } + {((isLoading && (!isOffline || isLocalFile)) || (!isLoading && zoomScale === 0)) && } + {isLoading && !isLocalFile && } ); } @@ -247,8 +249,8 @@ function ImageView({isAuthTokenRequired = false, url, fileName, onError}: ImageV /> - {isLoading && !isOffline && } - {isLoading && } + {isLoading && (!isOffline || isLocalFile) && } + {isLoading && !isLocalFile && } ); } diff --git a/src/components/Lightbox/index.tsx b/src/components/Lightbox/index.tsx index 0be0171eaa9a..6b3b7557cf58 100644 --- a/src/components/Lightbox/index.tsx +++ b/src/components/Lightbox/index.tsx @@ -197,6 +197,8 @@ function Lightbox({isAuthTokenRequired = false, uri, onScaleChanged: onScaleChan [onScaleChangedContext, onScaleChangedProp], ); + const isLocalFile = uri.startsWith('blob:') || uri.startsWith('file:'); + return ( )} - {isLoading && } + {isLoading && !isLocalFile && } )} From dd494e7f42e24aa54777a0a792111660a08e8b4a Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 13 Jun 2024 14:15:46 +0800 Subject: [PATCH 04/77] fix emoji cut off after edit --- .../HTMLEngineProvider/HTMLRenderers/EditedRenderer.tsx | 4 +++- src/pages/home/report/comment/TextCommentFragment.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/EditedRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/EditedRenderer.tsx index a548f39372ec..88e5c1f42555 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/EditedRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/EditedRenderer.tsx @@ -12,10 +12,12 @@ function EditedRenderer({tnode, TDefaultRenderer, style, ...defaultRendererProps const styles = useThemeStyles(); const {translate} = useLocalize(); const isPendingDelete = !!(tnode.attributes.deleted !== undefined); + const isLarge = !!(tnode.attributes.islarge !== undefined); return ( - + {' '} diff --git a/src/pages/home/report/comment/TextCommentFragment.tsx b/src/pages/home/report/comment/TextCommentFragment.tsx index f29acf8d35fc..28b4f9eebc88 100644 --- a/src/pages/home/report/comment/TextCommentFragment.tsx +++ b/src/pages/home/report/comment/TextCommentFragment.tsx @@ -53,7 +53,7 @@ function TextCommentFragment({fragment, styleAsDeleted, styleAsMuted = false, so // on other device, only render it as text if the only difference is
tag const containsOnlyEmojis = EmojiUtils.containsOnlyEmojis(text ?? ''); if (!shouldRenderAsText(html, text ?? '') && !(containsOnlyEmojis && styleAsDeleted)) { - const editedTag = fragment?.isEdited ? `` : ''; + const editedTag = fragment?.isEdited ? `` : ''; const htmlWithDeletedTag = styleAsDeleted ? `${html}` : html; const htmlContent = containsOnlyEmojis ? Str.replaceAll(htmlWithDeletedTag, '', '') : htmlWithDeletedTag; From 5153b9516ec9fbc90e2b7dab1560a2d6ffca4e39 Mon Sep 17 00:00:00 2001 From: dominictb Date: Thu, 13 Jun 2024 18:17:47 +0700 Subject: [PATCH 05/77] fix: set the cache directly --- src/pages/home/report/ReportActionItemMessageEdit.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/pages/home/report/ReportActionItemMessageEdit.tsx b/src/pages/home/report/ReportActionItemMessageEdit.tsx index e0becda218d7..70b426d6594e 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.tsx +++ b/src/pages/home/report/ReportActionItemMessageEdit.tsx @@ -109,18 +109,13 @@ function ReportActionItemMessageEdit( useEffect(() => { const parser = new ExpensiMark(); - const videoAttributesCache: Record = {}; + draftMessageVideoAttributeCache.clear(); const originalMessage = parser.htmlToMarkdown(action.message?.[0]?.html ?? '', { cacheVideoAttributes: (videoSource, attrs) => { - videoAttributesCache[videoSource] = attrs; + draftMessageVideoAttributeCache.set(videoSource, attrs); }, }); - draftMessageVideoAttributeCache.clear(); - for (const [videoSource, attrs] of Object.entries(videoAttributesCache)) { - draftMessageVideoAttributeCache.set(videoSource, attrs); - } - if (ReportActionsUtils.isDeletedAction(action) || !!(action.message && draftMessage === originalMessage) || !!(prevDraftMessage === draftMessage || isCommentPendingSaved.current)) { return; } From 1771b7c260de1d1556416305811a4ebb335cb155 Mon Sep 17 00:00:00 2001 From: Anusha Date: Thu, 13 Jun 2024 20:10:12 +0500 Subject: [PATCH 06/77] fix workspace empty state --- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- src/pages/workspace/WorkspacesListPage.tsx | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 1d3f495369d9..7ba463a41401 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2315,7 +2315,7 @@ export default { importedFromAccountingSoftware: 'The taxes below are imported from your', }, emptyWorkspace: { - title: 'Create a workspace', + title: 'Create a new workspace', subtitle: 'Workspaces are where you’ll chat with your team, reimburse expenses, issue cards, send invoices, pay bills, and more - all in one place.', createAWorkspaceCTA: 'Get Started', features: { diff --git a/src/languages/es.ts b/src/languages/es.ts index 93ed4853a113..0511557c4a6e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2354,7 +2354,7 @@ export default { importedFromAccountingSoftware: 'Impuestos importadas desde', }, emptyWorkspace: { - title: 'Crea un espacio de trabajo', + title: 'Crea un nuevo espacio de trabajo', subtitle: 'En los espacios de trabajo podrás chatear con tu equipo, reembolsar gastos, emitir tarjetas, enviar y pagar facturas, y mucho más - todo en un mismo lugar.', createAWorkspaceCTA: 'Comenzar', features: { diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index 599e8818b52c..c4ded14d3e7f 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -369,6 +369,7 @@ function WorkspacesListPage({policies, reimbursementAccount, reports, session}: title={translate('common.workspaces')} shouldShowBackButton={isSmallScreenWidth} onBackButtonPress={() => Navigation.goBack()} + icon={Illustrations.BigRocket} >