From d5a49abd00951b10a252f8e832b3767c1f33cb27 Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Fri, 11 Aug 2023 15:00:53 -1000 Subject: [PATCH 1/2] Disable link previews --- src/libs/Permissions.js | 9 +++++++++ src/pages/home/report/ReportActionItem.js | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libs/Permissions.js b/src/libs/Permissions.js index fc97436eddcb..f80f1878fc36 100644 --- a/src/libs/Permissions.js +++ b/src/libs/Permissions.js @@ -110,6 +110,14 @@ function canUseDistanceRequests(betas) { return _.contains(betas, CONST.BETAS.DISTANCE_REQUESTS) || canUseAllBetas(betas); } +/** + * Link previews are temporarily disabled. + * @returns {Boolean} + */ +function canUseLinkPreviews() { + return false; +} + export default { canUseChronos, canUsePayWithExpensify, @@ -123,4 +131,5 @@ export default { canUseScanReceipts, canUseCustomStatus, canUseDistanceRequests, + canUseLinkPreviews, }; diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 3c71b8bc62f3..00ca19a76604 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -64,6 +64,7 @@ import * as PersonalDetailsUtils from '../../../libs/PersonalDetailsUtils'; import ReportActionItemBasicMessage from './ReportActionItemBasicMessage'; import * as store from '../../../libs/actions/ReimbursementAccount/store'; import * as BankAccounts from '../../../libs/actions/BankAccounts'; +import * as Permissions from '../../../libs/Permissions'; const propTypes = { ...windowDimensionsPropTypes, @@ -155,6 +156,10 @@ function ReportActionItem(props) { }, [isDraftEmpty]); useEffect(() => { + if (!Permissions.canUseLinkPreviews()) { + return; + } + const urls = ReportActionsUtils.extractLinksFromMessageHtml(props.action); if (_.isEqual(downloadedPreviews.current, urls) || props.action.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) { return; @@ -380,7 +385,7 @@ function ReportActionItem(props) { return ( <> {children} - {!isHidden && !_.isEmpty(props.action.linkMetadata) && ( + {Permissions.canUseLinkPreviews() && !isHidden && !_.isEmpty(props.action.linkMetadata) && ( !_.isEmpty(item))} /> From da0b8f28631648627dd12362972545039104f611 Mon Sep 17 00:00:00 2001 From: Marc Glasser Date: Mon, 14 Aug 2023 15:35:57 -1000 Subject: [PATCH 2/2] Fix import --- src/pages/home/report/ReportActionItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 00ca19a76604..fd0cdb6f5a8e 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -64,7 +64,7 @@ import * as PersonalDetailsUtils from '../../../libs/PersonalDetailsUtils'; import ReportActionItemBasicMessage from './ReportActionItemBasicMessage'; import * as store from '../../../libs/actions/ReimbursementAccount/store'; import * as BankAccounts from '../../../libs/actions/BankAccounts'; -import * as Permissions from '../../../libs/Permissions'; +import Permissions from '../../../libs/Permissions'; const propTypes = { ...windowDimensionsPropTypes,