From ad9ba61167e344cf3123b763d2a6c72c3b40d7dc Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 29 Nov 2023 13:35:45 +0700 Subject: [PATCH 01/27] fix: room name in invite message does not show link --- src/libs/ReportUtils.ts | 9 +++++-- .../report/ContextMenu/ContextMenuActions.js | 24 ++++++++++++------- src/types/onyx/OriginalMessage.ts | 1 + 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index d93661778b83..8ea82d91e0bf 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -23,6 +23,7 @@ import DeepValueOf from '@src/types/utils/DeepValueOf'; import {EmptyObject, isEmptyObject, isNotEmptyObject} from '@src/types/utils/EmptyObject'; import * as CurrencyUtils from './CurrencyUtils'; import DateUtils from './DateUtils'; +import * as Environment from './Environment/Environment'; import isReportMessageAttachment from './isReportMessageAttachment'; import * as LocalePhoneNumber from './LocalePhoneNumber'; import * as Localize from './Localize'; @@ -346,6 +347,9 @@ type OnyxDataTaskAssigneeChat = { optimisticChatCreatedReportAction?: OptimisticCreatedReportAction; }; +let environmentURL: string; +Environment.getEnvironmentURL().then((url: string) => (environmentURL = url)); + let currentUserEmail: string | undefined; let currentUserAccountID: number | undefined; let isAnonymousUser = false; @@ -4164,13 +4168,14 @@ function getChannelLogMemberMessage(reportAction: OnyxEntry): stri message = `${verb} ${mentions?.join(', ')}, and ${lastMention}`; } + const reportID = (reportAction?.originalMessage as ChangeLog)?.reportID ?? 0; const roomName = (reportAction?.originalMessage as ChangeLog)?.roomName ?? ''; - if (roomName) { + if (reportID && roomName) { const preposition = reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.INVITE_TO_ROOM || reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG.INVITE_TO_ROOM ? ' to' : ' from'; - message += `${preposition} ${roomName}`; + message += `${preposition} ${roomName}`; } return message; diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 4f35926c5957..973971c60f72 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -23,6 +23,20 @@ import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; import {clearActiveReportAction, hideContextMenu, showDeleteModal} from './ReportActionContextMenu'; +/** + * Sets the HTML string to Clipboard. + * @param {String} content + */ +function setClipboardHtmlMessage(content) { + const parser = new ExpensiMark(); + if (!Clipboard.canSetHtml()) { + Clipboard.setString(parser.htmlToMarkdown(content)); + } else { + const plainText = parser.htmlToText(content); + Clipboard.setHtml(content, plainText); + } +} + /** * Gets the HTML version of the message in an action. * @param {Object} reportAction @@ -283,15 +297,9 @@ export default [ Clipboard.setString(displayMessage); } else if (ReportActionsUtils.isChannelLogMemberAction(reportAction)) { const logMessage = ReportUtils.getChannelLogMemberMessage(reportAction); - Clipboard.setString(logMessage); + setClipboardHtmlMessage(logMessage); } else if (content) { - const parser = new ExpensiMark(); - if (!Clipboard.canSetHtml()) { - Clipboard.setString(parser.htmlToMarkdown(content)); - } else { - const plainText = parser.htmlToText(content); - Clipboard.setHtml(content, plainText); - } + setClipboardHtmlMessage(content); } } diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 0dc532ebeded..b00dee0df96a 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -140,6 +140,7 @@ type ChronosOOOTimestamp = { type ChangeLog = { targetAccountIDs?: number[]; roomName?: string; + reportID?: number; }; type ChronosOOOEvent = { From ebcd66fd9fe5ccb98c384281342e2e162bf29b20 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 29 Nov 2023 13:50:25 +0700 Subject: [PATCH 02/27] remove redundat escape charaters --- src/libs/ReportUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 8ea82d91e0bf..728cf44d7d9f 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4175,7 +4175,7 @@ function getChannelLogMemberMessage(reportAction: OnyxEntry): stri reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.INVITE_TO_ROOM || reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG.INVITE_TO_ROOM ? ' to' : ' from'; - message += `${preposition} ${roomName}`; + message += `${preposition} ${roomName}`; } return message; From fd0a9a9eb6325ba8e0643b3d250217831244d336 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 29 Nov 2023 13:57:06 +0700 Subject: [PATCH 03/27] fix: mention in copied invite message shown as hidden --- src/libs/ReportUtils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 728cf44d7d9f..49af0c71c8fb 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4151,8 +4151,8 @@ function getChannelLogMemberMessage(reportAction: OnyxEntry): stri ? 'invited' : 'removed'; - const mentions = (reportAction?.originalMessage as ChangeLog)?.targetAccountIDs?.map(() => { - const personalDetail = allPersonalDetails?.accountID; + const mentions = (reportAction?.originalMessage as ChangeLog)?.targetAccountIDs?.map((accountID) => { + const personalDetail = allPersonalDetails?.[accountID]; const displayNameOrLogin = LocalePhoneNumber.formatPhoneNumber(personalDetail?.login ?? '') || (personalDetail?.displayName ?? '') || Localize.translateLocal('common.hidden'); return `@${displayNameOrLogin}`; }); From d254e4f8316b468730264728bcd8a626d603c888 Mon Sep 17 00:00:00 2001 From: Maciej Dobosz Date: Fri, 1 Dec 2023 12:50:53 +0100 Subject: [PATCH 04/27] Create a Workspace card --- src/languages/en.ts | 3 ++ src/languages/es.ts | 3 ++ src/pages/home/sidebar/SidebarLinks.js | 4 +++ .../card/WorkspaceCardCreateAWorkspace.tsx | 31 +++++++++++++++++++ src/styles/themes/default.ts | 2 +- 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/pages/workspace/card/WorkspaceCardCreateAWorkspace.tsx diff --git a/src/languages/en.ts b/src/languages/en.ts index 8f772f1260bb..b5a9261e9944 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1492,6 +1492,9 @@ export default { benefit4: 'Customizable limits', addWorkEmail: 'Add work email address', checkingDomain: 'Hang tight! We are still working on enabling your Expensify Cards. Check back here in a few minutes.', + createAWorkspace: 'Create a workspace', + createAWorkspaceCopy: 'Manage business expenses, issue cards, send invoices, and more.', + createAWorkspaceCTA: 'Get Started', }, reimburse: { captureReceipts: 'Capture receipts', diff --git a/src/languages/es.ts b/src/languages/es.ts index 3887891299df..2f2244a9674a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1514,6 +1514,9 @@ export default { benefit4: 'Límites personalizables', addWorkEmail: 'Añadir correo electrónico de trabajo', checkingDomain: '¡Un momento! Estamos todavía trabajando para habilitar tu Tarjeta Expensify. Vuelve aquí en unos minutos.', + createAWorkspace: 'Crear un espacio de trabajo', + createAWorkspaceCopy: 'Administre gastos comerciales, emita tarjetas, envíe facturas y más.', + createAWorkspaceCTA: 'Comenzar', }, reimburse: { captureReceipts: 'Captura recibos', diff --git a/src/pages/home/sidebar/SidebarLinks.js b/src/pages/home/sidebar/SidebarLinks.js index 2aba742f157f..100d746f6524 100644 --- a/src/pages/home/sidebar/SidebarLinks.js +++ b/src/pages/home/sidebar/SidebarLinks.js @@ -19,6 +19,7 @@ import onyxSubscribe from '@libs/onyxSubscribe'; import SidebarUtils from '@libs/SidebarUtils'; import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportActionContextMenu'; import safeAreaInsetPropTypes from '@pages/safeAreaInsetPropTypes'; +import WorkspaceCardCreateAWorkspace from '@pages/workspace/card/WorkspaceCardCreateAWorkspace'; import * as StyleUtils from '@styles/StyleUtils'; import useTheme from '@styles/themes/useTheme'; import useThemeStyles from '@styles/useThemeStyles'; @@ -177,6 +178,9 @@ function SidebarLinks({onLinkClick, insets, optionListItems, isLoading, priority + + + +