Skip to content
Merged
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
25 changes: 23 additions & 2 deletions src/pages/home/report/ReportActionContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ReportActionContextMenu extends React.Component {
this.confirmDeleteAndHideModal = this.confirmDeleteAndHideModal.bind(this);
this.hideDeleteConfirmModal = this.hideDeleteConfirmModal.bind(this);
this.getActionText = this.getActionText.bind(this);
this.hidePopover = this.hidePopover.bind(this);

// A list of all the context actions in this menu.
this.contextActions = [
Expand All @@ -86,6 +87,7 @@ class ReportActionContextMenu extends React.Component {
} else {
Clipboard.setString(html);
}
this.hidePopover(true);
},
},

Expand All @@ -104,6 +106,7 @@ class ReportActionContextMenu extends React.Component {
onPress: () => {
updateLastReadActionID(this.props.reportID, this.props.reportAction.sequenceNumber);
setNewMarkerPosition(this.props.reportID, this.props.reportAction.sequenceNumber);
this.hidePopover(true);
},
},

Expand All @@ -112,7 +115,7 @@ class ReportActionContextMenu extends React.Component {
icon: Pencil,
shouldShow: () => canEditReportAction(this.props.reportAction),
onPress: () => {
this.props.hidePopover();
this.hidePopover();
saveReportActionDraft(
this.props.reportID,
this.props.reportAction.reportActionID,
Expand All @@ -124,7 +127,9 @@ class ReportActionContextMenu extends React.Component {
text: this.props.translate('reportActionContextMenu.deleteComment'),
icon: Trashcan,
shouldShow: () => canEditReportAction(this.props.reportAction),
onPress: () => this.setState({isDeleteCommentConfirmModalVisible: true}),
onPress: () => {
this.setState({isDeleteCommentConfirmModalVisible: true});
},
},
];

Expand All @@ -148,10 +153,26 @@ class ReportActionContextMenu extends React.Component {
confirmDeleteAndHideModal() {
deleteReportComment(this.props.reportID, this.props.reportAction);
this.setState({isDeleteCommentConfirmModalVisible: false});
this.hidePopover();
}

hideDeleteConfirmModal() {
this.setState({isDeleteCommentConfirmModalVisible: false});
this.hidePopover();
}

/**
* Hides the popover menu with an optional delay
*
* @param {Boolean} shouldDelay whether the menu should close after a delay
* @memberof ReportActionContextMenu
*/
hidePopover(shouldDelay) {
if (!shouldDelay) {
this.props.hidePopover();
return;
}
setTimeout(this.props.hidePopover, 800);
}

render() {
Expand Down