From 031fa0173438f978e8fb6357f4c2b8224a94776d Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Wed, 3 Jul 2024 11:05:15 -0700 Subject: [PATCH 1/4] Add comment linking beta const --- src/CONST.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CONST.ts b/src/CONST.ts index 9bba8d509642..00f2245a55c0 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -369,6 +369,7 @@ const CONST = { WORKSPACE_FEEDS: 'workspaceFeeds', NETSUITE_USA_TAX: 'netsuiteUsaTax', INTACCT_ON_NEW_EXPENSIFY: 'intacctOnNewExpensify', + COMMENT_LINKING: 'commentLinking', }, BUTTON_STATES: { DEFAULT: 'default', From b36fac7fc1891fa0fa5d44fdca01f04e1d39fdc6 Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Wed, 3 Jul 2024 11:05:24 -0700 Subject: [PATCH 2/4] Add canUseCommentLinking --- src/libs/Permissions.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index faea5965fee4..aafc38a9040b 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -60,6 +60,10 @@ function canUseNetSuiteUSATax(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.NETSUITE_USA_TAX) || canUseAllBetas(betas); } +function canUseCommentLinking(betas: OnyxEntry): boolean { + return !!betas?.includes(CONST.BETAS.COMMENT_LINKING) || canUseAllBetas(betas); +} + /** * Link previews are temporarily disabled. */ @@ -82,4 +86,5 @@ export default { canUseReportFieldsFeature, canUseWorkspaceFeeds, canUseNetSuiteUSATax, + canUseCommentLinking, }; From 7ca632b626a8ac18482850628352a5cb095e73ab Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Wed, 3 Jul 2024 11:05:39 -0700 Subject: [PATCH 3/4] Ensure "Copy Link" option is behind comment linking beta --- src/pages/home/report/ContextMenu/ContextMenuActions.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index bf634b4ac8ae..b5972025bf89 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -29,6 +29,7 @@ import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ROUTES from '@src/ROUTES'; import type {Beta, OnyxInputOrEntry, ReportAction, ReportActionReactions, Transaction} from '@src/types/onyx'; +import Permissions from '@libs/Permissions'; import type IconAsset from '@src/types/utils/IconAsset'; import type {ContextMenuAnchor} from './ReportActionContextMenu'; import {hideContextMenu, showDeleteModal} from './ReportActionContextMenu'; @@ -425,6 +426,10 @@ const ContextMenuActions: ContextMenuAction[] = [ successIcon: Expensicons.Checkmark, successTextTranslateKey: 'reportActionContextMenu.copied', shouldShow: (type, reportAction, isArchivedRoom, betas, menuTarget) => { + if (!Permissions.canUseCommentLinking(betas)) { + return false; + } + const isAttachment = ReportActionsUtils.isReportActionAttachment(reportAction); // Only hide the copylink menu item when context menu is opened over img element. From 06134038fac0fc0e2cc6c420df056ce0dc78259b Mon Sep 17 00:00:00 2001 From: Jasper Huang Date: Wed, 3 Jul 2024 11:06:43 -0700 Subject: [PATCH 4/4] style --- src/pages/home/report/ContextMenu/ContextMenuActions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index b5972025bf89..0e29e7496def 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -19,6 +19,7 @@ import * as Localize from '@libs/Localize'; import ModifiedExpenseMessage from '@libs/ModifiedExpenseMessage'; import Navigation from '@libs/Navigation/Navigation'; import {parseHtmlToMarkdown, parseHtmlToText} from '@libs/OnyxAwareParser'; +import Permissions from '@libs/Permissions'; import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; @@ -29,7 +30,6 @@ import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ROUTES from '@src/ROUTES'; import type {Beta, OnyxInputOrEntry, ReportAction, ReportActionReactions, Transaction} from '@src/types/onyx'; -import Permissions from '@libs/Permissions'; import type IconAsset from '@src/types/utils/IconAsset'; import type {ContextMenuAnchor} from './ReportActionContextMenu'; import {hideContextMenu, showDeleteModal} from './ReportActionContextMenu';