From d09d2d964058f9aca9e58ae1784b0f552d92d49a Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Mon, 5 Apr 2021 15:58:07 -0700 Subject: [PATCH 1/3] Use shouldShow field of context actions to hide non-functioning menu items --- src/pages/home/report/ReportActionContextMenu.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionContextMenu.js b/src/pages/home/report/ReportActionContextMenu.js index e667ba5c65f9..f3055f775deb 100644 --- a/src/pages/home/report/ReportActionContextMenu.js +++ b/src/pages/home/report/ReportActionContextMenu.js @@ -22,6 +22,7 @@ const CONTEXT_ACTIONS = [ icon: ClipboardIcon, successText: 'Copied!', successIcon: Checkmark, + shouldShow: true, // If return value is true, we switch the `text` and `icon` on // `ReportActionContextMenuItem` with `successText` and `successIcon` which will fallback to @@ -45,6 +46,7 @@ const CONTEXT_ACTIONS = [ { text: 'Copy Link', icon: LinkCopy, + shouldShow: false, onPress: () => {}, }, @@ -52,6 +54,7 @@ const CONTEXT_ACTIONS = [ { text: 'Mark as Unread', icon: Mail, + shouldShow: false, onPress: () => {}, }, @@ -59,6 +62,7 @@ const CONTEXT_ACTIONS = [ { text: 'Edit Comment', icon: Pencil, + shouldShow: false, onPress: () => {}, }, @@ -66,6 +70,7 @@ const CONTEXT_ACTIONS = [ { text: 'Delete Comment', icon: Trashcan, + shouldShow: false, onPress: () => {}, }, ]; @@ -95,7 +100,7 @@ const ReportActionContextMenu = (props) => { const wrapperStyle = getReportActionContextMenuStyles(props.isMini); return props.isVisible && ( - {CONTEXT_ACTIONS.map(contextAction => ( + {CONTEXT_ACTIONS.map(contextAction => contextAction.shouldShow && ( Date: Mon, 5 Apr 2021 16:07:33 -0700 Subject: [PATCH 2/3] Remove reportActionContextMenu beta from the E.cash front-end --- src/pages/home/report/ReportActionItem.js | 29 +---------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index c40efa8d516d..0430c2f33a62 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -2,9 +2,6 @@ import _ from 'underscore'; import React, {Component} from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; -import {withOnyx} from 'react-native-onyx'; -import CONST from '../../../CONST'; -import ONYXKEYS from '../../../ONYXKEYS'; import ReportActionPropTypes from './ReportActionPropTypes'; import { getReportActionItemStyle, @@ -26,14 +23,6 @@ const propTypes = { // Should the comment have the appearance of being grouped with the previous comment? displayAsGroup: PropTypes.bool.isRequired, - - /* --- Onyx Props --- */ - // List of betas for the current user. - betas: PropTypes.arrayOf(PropTypes.string), -}; - -const defaultProps = { - betas: {}, }; class ReportActionItem extends Component { @@ -50,7 +39,6 @@ class ReportActionItem extends Component { vertical: 0, }; - this.isInReportActionContextMenuBeta = this.isInReportActionContextMenuBeta.bind(this); this.showPopover = this.showPopover.bind(this); this.hidePopover = this.hidePopover.bind(this); } @@ -61,16 +49,6 @@ class ReportActionItem extends Component { || !_.isEqual(this.props.action, nextProps.action); } - /** - * Is the current user in the ReportActionContextMenu beta? - * - * @returns {Boolean} - */ - isInReportActionContextMenuBeta() { - return _.contains(this.props.betas, CONST.BETAS.REPORT_ACTION_CONTEXT_MENU) - || _.contains(this.props.betas, CONST.BETAS.ALL); - } - /** * Save the location of a native press event. * @@ -154,10 +132,5 @@ class ReportActionItem extends Component { } ReportActionItem.propTypes = propTypes; -ReportActionItem.defaultProps = defaultProps; -export default withOnyx({ - betas: { - key: ONYXKEYS.BETAS, - }, -})(ReportActionItem); +export default ReportActionItem; From 90030d9f2d2f26d24b9e87377976df45b447a123 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Mon, 5 Apr 2021 17:07:46 -0700 Subject: [PATCH 3/3] Remove remaining uses of reportActionContextMenuBeta --- src/CONST.js | 1 - src/pages/home/report/ReportActionItem.js | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/CONST.js b/src/CONST.js index ce39818a791d..76c870f16f58 100644 --- a/src/CONST.js +++ b/src/CONST.js @@ -3,7 +3,6 @@ const CLOUDFRONT_URL = 'https://d2k5nsl2zxldvw.cloudfront.net'; const CONST = { BETAS: { ALL: 'all', - REPORT_ACTION_CONTEXT_MENU: 'reportActionContextMenu', }, BUTTON_STATES: { DEFAULT: 'default', diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 0430c2f33a62..3cc279702809 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -69,9 +69,7 @@ class ReportActionItem extends Component { showPopover(event) { const nativeEvent = event.nativeEvent || {}; this.capturePressLocation(nativeEvent); - if (this.isInReportActionContextMenuBeta()) { - this.setState({isPopoverVisible: true}); - } + this.setState({isPopoverVisible: true}); } /** @@ -98,7 +96,6 @@ class ReportActionItem extends Component { reportAction={this.props.action} isVisible={ hovered - && this.isInReportActionContextMenuBeta() && !this.state.isPopoverVisible } isMini