Skip to content

Commit

Permalink
Merge pull request #24475 from Expensify/marcaaron-linkPreviewDisable
Browse files Browse the repository at this point in the history
Put link previews behind a beta for now
  • Loading branch information
srikarparsi authored Aug 15, 2023
2 parents 91f4082 + da0b8f2 commit c43491a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/libs/Permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -123,4 +131,5 @@ export default {
canUseScanReceipts,
canUseCustomStatus,
canUseDistanceRequests,
canUseLinkPreviews,
};
7 changes: 6 additions & 1 deletion src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 Permissions from '../../../libs/Permissions';

const propTypes = {
...windowDimensionsPropTypes,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -382,7 +387,7 @@ function ReportActionItem(props) {
return (
<>
{children}
{!isHidden && !_.isEmpty(props.action.linkMetadata) && (
{Permissions.canUseLinkPreviews() && !isHidden && !_.isEmpty(props.action.linkMetadata) && (
<View style={props.draftMessage ? styles.chatItemReactionsDraftRight : {}}>
<LinkPreviewer linkMetadata={_.filter(props.action.linkMetadata, (item) => !_.isEmpty(item))} />
</View>
Expand Down

0 comments on commit c43491a

Please sign in to comment.