Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const CONST = {
FREE_PLAN: 'freePlan',
DEFAULT_ROOMS: 'defaultRooms',
BETA_EXPENSIFY_WALLET: 'expensifyWallet',
BETA_COMMENT_LINKING: 'commentLinking',
INTERNATIONALIZATION: 'internationalization',
IOU_SEND: 'sendMoney',
POLICY_ROOMS: 'policyRooms',
Expand Down
9 changes: 9 additions & 0 deletions src/libs/Permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ function canUseWallet(betas) {
return _.contains(betas, CONST.BETAS.BETA_EXPENSIFY_WALLET) || canUseAllBetas(betas);
}

/**
* @param {Array<String>} betas
* @returns {Boolean}
*/
function canUseCommentLinking(betas) {
return _.contains(betas, CONST.BETAS.BETA_COMMENT_LINKING) || canUseAllBetas(betas);
}

/**
* We're requiring you to be added to the policy rooms beta on dev,
* since contributors have been reporting a number of false issues related to the feature being under development.
Expand Down Expand Up @@ -94,6 +102,7 @@ export default {
canUseInternationalization,
canUseIOUSend,
canUseWallet,
canUseCommentLinking,
canUsePolicyRooms,
canUsePolicyExpenseChat,
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import PropTypes from 'prop-types';
import getReportActionContextMenuStyles from '../../../../styles/getReportActionContextMenuStyles';
Expand All @@ -12,6 +13,7 @@ import withLocalize, {withLocalizePropTypes} from '../../../../components/withLo
import ContextMenuActions, {CONTEXT_MENU_TYPES} from './ContextMenuActions';
import compose from '../../../../libs/compose';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../../components/withWindowDimensions';
import ONYXKEYS from '../../../../ONYXKEYS';

const propTypes = {
/** String representing the context menu type [LINK, REPORT_ACTION] which controls context menu choices */
Expand All @@ -32,7 +34,7 @@ class BaseReportActionContextMenu extends React.Component {
}

render() {
const shouldShowFilter = contextAction => contextAction.shouldShow(this.props.type, this.props.reportAction);
const shouldShowFilter = contextAction => contextAction.shouldShow(this.props.type, this.props.reportAction, this.props.betas);

return this.props.isVisible && (
<View style={this.wrapperStyle}>
Expand Down Expand Up @@ -65,5 +67,10 @@ BaseReportActionContextMenu.defaultProps = defaultProps;

export default compose(
withLocalize,
withOnyx({
betas: {
key: ONYXKEYS.BETAS,
},
}),
withWindowDimensions,
)(BaseReportActionContextMenu);
3 changes: 2 additions & 1 deletion src/pages/home/report/ContextMenu/ContextMenuActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import fileDownload from '../../../../libs/fileDownload';
import addEncryptedAuthTokenToURL from '../../../../libs/addEncryptedAuthTokenToURL';
import * as ContextMenuUtils from './ContextMenuUtils';
import * as Environment from '../../../../libs/Environment/Environment';
import Permissions from '../../../../libs/Permissions';

/**
* Gets the HTML version of the message in an action.
Expand Down Expand Up @@ -121,7 +122,7 @@ export default [
{
textTranslateKey: 'reportActionContextMenu.copyLink',
icon: Expensicons.LinkCopy,
shouldShow: () => true,
shouldShow: (type, reportAction, betas) => Permissions.canUseCommentLinking(betas),
Comment thread
Gonals marked this conversation as resolved.
onPress: (closePopover, {reportAction, reportID}) => {
Environment.getEnvironmentURL()
.then((environmentURL) => {
Expand Down