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: 0 additions & 1 deletion src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
7 changes: 6 additions & 1 deletion src/pages/home/report/ReportActionContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,27 +46,31 @@ const CONTEXT_ACTIONS = [
{
text: 'Copy Link',
icon: LinkCopy,
shouldShow: false,
onPress: () => {},
},

// Mark as Unread
{
text: 'Mark as Unread',
icon: Mail,
shouldShow: false,
onPress: () => {},
},

// Edit Comment
{
text: 'Edit Comment',
icon: Pencil,
shouldShow: false,
onPress: () => {},
},

// Delete Comment
{
text: 'Delete Comment',
icon: Trashcan,
shouldShow: false,
onPress: () => {},
},
];
Expand Down Expand Up @@ -95,7 +100,7 @@ const ReportActionContextMenu = (props) => {
const wrapperStyle = getReportActionContextMenuStyles(props.isMini);
return props.isVisible && (
<View style={wrapperStyle}>
{CONTEXT_ACTIONS.map(contextAction => (
{CONTEXT_ACTIONS.map(contextAction => contextAction.shouldShow && (
<ReportActionContextMenuItem
icon={contextAction.icon}
text={contextAction.text}
Expand Down
34 changes: 2 additions & 32 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -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);
}
Expand All @@ -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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this beta constant? It looks like its unused now

|| _.contains(this.props.betas, CONST.BETAS.ALL);
}

/**
* Save the location of a native press event.
*
Expand All @@ -91,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});
}

/**
Expand All @@ -120,7 +96,6 @@ class ReportActionItem extends Component {
reportAction={this.props.action}
isVisible={
hovered
&& this.isInReportActionContextMenuBeta()
&& !this.state.isPopoverVisible
}
isMini
Expand Down Expand Up @@ -154,10 +129,5 @@ class ReportActionItem extends Component {
}

ReportActionItem.propTypes = propTypes;
ReportActionItem.defaultProps = defaultProps;

export default withOnyx({
betas: {
key: ONYXKEYS.BETAS,
},
})(ReportActionItem);
export default ReportActionItem;