Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Comments #2046

Merged
merged 82 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
4607f2c
started work on this
sketchydroide Mar 24, 2021
fbdba19
correcting the command, and cleaning a bit
sketchydroide Mar 24, 2021
4f78dbd
editing adding press
sketchydroide Mar 25, 2021
831e55a
adding on press on the correct side
sketchydroide Mar 26, 2021
b667c12
I need to give myself the beta
sketchydroide Mar 26, 2021
83811f4
Using ONYX to call delete comment
sketchydroide Apr 6, 2021
3f5e2e3
Merge branch 'master' into afonseca_delete_comments
sketchydroide Apr 6, 2021
e4719dd
a couple of small changes needed after the merge
sketchydroide Apr 6, 2021
3bc3e83
ok this works now,
sketchydroide Apr 6, 2021
7c44b08
updating the name and how we call `deleteReportAction`
sketchydroide Apr 7, 2021
ed28d4c
transforming ReportActionContextMenu into a class
sketchydroide Apr 7, 2021
bc5b393
doing an optimistic response
sketchydroide Apr 7, 2021
7a38825
using the correct copy
sketchydroide Apr 9, 2021
9127eea
Merge branch 'master' into afonseca_delete_comments
sketchydroide Apr 9, 2021
e144e3a
need to use sequence number for now
sketchydroide Apr 9, 2021
0d6827a
cleaning
sketchydroide Apr 9, 2021
91f915d
fixing linter
sketchydroide Apr 12, 2021
802b053
filtering this correctly
sketchydroide Apr 12, 2021
fe20205
Merge branch 'main' into afonseca_delete_comments
sketchydroide Apr 19, 2021
268daf4
it does not need the action ID
sketchydroide Apr 19, 2021
984c8fb
correct comment
sketchydroide Apr 19, 2021
94d72d4
using camelCase
sketchydroide Apr 19, 2021
9075af9
adding the session
sketchydroide Apr 19, 2021
99f0e69
changing deleteReportAction to deleteReportComment
sketchydroide Apr 20, 2021
2898c4c
Merge branch 'main' into afonseca_delete_comments
sketchydroide Apr 20, 2021
2695396
fix import
sketchydroide Apr 20, 2021
5c3ea4f
remove unused onyx key
sketchydroide Apr 21, 2021
efd5baf
using a function outside constructor
sketchydroide Apr 21, 2021
cd715d4
adding a comment
sketchydroide Apr 21, 2021
20f5166
using reportActionID
sketchydroide Apr 21, 2021
fa64c3a
Merge branch 'main' into afonseca_delete_comments
sketchydroide Apr 21, 2021
8c6e983
improving comments,
sketchydroide Apr 22, 2021
fb80f67
refactoring the contextMenu
sketchydroide Apr 22, 2021
0f3d9bb
update comment, and refactor logic for the filter, make it more legible.
sketchydroide Apr 22, 2021
4db4017
fixing the response, and reverse of deletion
sketchydroide Apr 28, 2021
c9802da
using response instead of data
sketchydroide Apr 29, 2021
12d34a2
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 5, 2021
a639e77
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 6, 2021
a6fb1a0
fixing merge broken things
sketchydroide May 6, 2021
adcd32a
some more fixes from merge
sketchydroide May 6, 2021
eb0dd41
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 7, 2021
83f9a9b
add modal to confirm
sketchydroide May 12, 2021
f694247
adding the modal to the ReportActionContextMenu
sketchydroide May 12, 2021
049d402
fixing travis errors:
sketchydroide May 13, 2021
ab22572
showing the modal correctly now
sketchydroide May 13, 2021
f0cca13
on hide we should do a cancel as well
sketchydroide May 13, 2021
dff673d
actual deleting if you press enter
sketchydroide May 13, 2021
2f05393
using the modal directly
sketchydroide May 13, 2021
7a85a88
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 13, 2021
ccdacf0
remove duplicated
sketchydroide May 13, 2021
1af55ea
still fix merges
sketchydroide May 13, 2021
b09d259
this needs to be a ()=> to
sketchydroide May 13, 2021
a57908f
no need to have this around
sketchydroide May 14, 2021
0db0564
don't dismiss action menu if clicked outside.
sketchydroide May 14, 2021
b7f975e
add translate
sketchydroide May 14, 2021
2d48f4c
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 14, 2021
4b25ec0
updated pod?
sketchydroide May 14, 2021
702b709
reseting this, fixed what was wrong elsewhere
sketchydroide May 14, 2021
5c68540
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 17, 2021
8678c07
handling a bunch of comments:
sketchydroide May 17, 2021
3f166d6
fix linter - extra `)` removed
sketchydroide May 17, 2021
5503c8d
removed info log, not necessary
sketchydroide May 17, 2021
a148398
can only edit/delete if we have a reportActionID
sketchydroide May 17, 2021
35c5aa1
needs to go to a new line
sketchydroide May 17, 2021
8d6f0b5
this still need to be methods
sketchydroide May 17, 2021
586d79a
canEdit instead of isUserActorOfAction
sketchydroide May 19, 2021
76d93fe
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 20, 2021
bd3d300
using common for delete and cancel
sketchydroide May 20, 2021
bb863a6
removing check for text, use only html
sketchydroide May 20, 2021
3a09346
doesn't need the ()
sketchydroide May 20, 2021
23f2cb8
using `_.result(`
sketchydroide May 20, 2021
b2f48a9
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 21, 2021
d156556
setting back
sketchydroide May 21, 2021
9c73a88
after adding binding this works
sketchydroide May 21, 2021
e9afb8b
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 24, 2021
da1136f
removing some unneeded comments, and adding a specification to another
sketchydroide May 24, 2021
f10de2e
remove contextActions from outside class.
sketchydroide May 24, 2021
d7691d5
Revert "remove contextActions from outside class."
sketchydroide May 25, 2021
4b85cc1
Merge branch 'main' into afonseca_delete_comments
sketchydroide May 27, 2021
38e2d40
only show the delete and edit for ADDCOMMENTS
sketchydroide May 27, 2021
d0e8520
Adding a const for the Message type Comment as well
sketchydroide May 27, 2021
6122f49
add a comment to `canEdit`
sketchydroide May 27, 2021
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
6 changes: 6 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ const CONST = {
LIMIT: 50,
TYPE: {
IOU: 'IOU',
ADDCOMMENT: 'ADDCOMMENT',
},
},
MESSAGE: {
TYPE: {
COMMENT: 'COMMENT',
},
},
TYPE: {
Expand Down
4 changes: 4 additions & 0 deletions src/components/Hoverable/HoverablePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ const propTypes = {

/** Function that executes when the mouse leaves the children. */
onHoverOut: PropTypes.func,

// If the mouse clicks outside, should we dismiss hover?
resetsOnClickOutside: PropTypes.bool,
};

const defaultProps = {
containerStyle: {},
onHoverIn: () => {},
onHoverOut: () => {},
resetsOnClickOutside: false,
};

export {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Hoverable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Hoverable extends Component {
if (!this.state.isHovered) {
return;
}
if (this.wrapperView && !this.wrapperView.contains(event.target)) {
if (this.wrapperView && !this.wrapperView.contains(event.target) && this.props.resetsOnClickOutside) {
this.setIsHovered(false);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default {
email: 'Email',
and: 'and',
details: 'Details',
delete: 'Delete',
contacts: 'Contacts',
recents: 'Recents',
},
Expand Down Expand Up @@ -84,6 +85,7 @@ export default {
markAsUnread: 'Mark as Unread',
editComment: 'Edit Comment',
deleteComment: 'Delete Comment',
deleteConfirmation: 'Are you sure you want to delete this comment?',
},
reportActionsView: {
beFirstPersonToComment: 'Be the first person to comment',
Expand Down
4 changes: 2 additions & 2 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,9 @@ function Report_TogglePinned(parameters) {
/**
* @param {Object} parameters
* @param {Number} parameters.reportID
* @param {String} parameters.reportActionID
* @param {Number} parameters.reportActionID
* @param {String} parameters.reportComment
* @return {Promise}
* @returns {Promise}
*/
function Report_EditComment(parameters) {
const commandName = 'Report_EditComment';
Expand Down
47 changes: 45 additions & 2 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,7 @@ function addAction(reportID, text, file) {
// Optimistically add the new comment to the store before waiting to save it to the server
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
[optimisticReportActionID]: {
actionName: 'ADDCOMMENT',
actionName: CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT,
actorEmail: currentUserEmail,
actorAccountID: currentUserAccountID,
person: [
Expand All @@ -1023,7 +1023,7 @@ function addAction(reportID, text, file) {
timestamp: moment().unix(),
message: [
{
type: 'COMMENT',
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
html: htmlForNewComment,
text: textForNewComment,
},
Expand All @@ -1049,6 +1049,48 @@ function addAction(reportID, text, file) {
.then(({reportAction}) => updateReportWithNewAction(reportID, reportAction));
}

/**
* Deletes a comment from the report, basically sets it as empty string
*
* @param {Number} reportID
* @param {Object} reportAction
*/
function deleteReportComment(reportID, reportAction) {
// Optimistic Response
const reportActionsToMerge = {};
const oldMessage = {...reportAction.message};
reportActionsToMerge[reportAction.sequenceNumber] = {
...reportAction,
message: [
{
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
html: '',
text: '',
},
],
};

Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, reportActionsToMerge);

// Try to delete the comment by calling the API
API.Report_EditComment({
reportID,
reportActionID: reportAction.reportActionID,
reportComment: '',
})
.then((response) => {
if (response.jsonCode !== 200) {
// Reverse Optimistic Response
reportActionsToMerge[reportAction.sequenceNumber] = {
...reportAction,
message: oldMessage,
};

Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, reportActionsToMerge);
Comment on lines +1083 to +1089
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is only the second time that something is making optimistic changes, other than adding a report comment. I think it's a cool pattern, and probably something that we should try to abstract at some point that would be easier for other actions to use as well. Nothing actionable here, but I wanted to note down the thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that sounds great, there is a certain amount of overhead to do it, so abstraction would be great, specially before we bring the expenses and reports into .cash

}
});
}

/**
* Updates the last read action ID on the report. It optimistically makes the change to the store, and then let's the
* network layer handle the delayed write.
Expand Down Expand Up @@ -1219,5 +1261,6 @@ export {
updateCurrentlyViewedReportID,
editReportComment,
saveReportActionDraft,
deleteReportComment,
getSimplifiedIOUReport,
};
61 changes: 52 additions & 9 deletions src/pages/home/report/ReportActionContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ import {
Clipboard as ClipboardIcon, LinkCopy, Mail, Pencil, Trashcan, Checkmark,
} from '../../../components/Icon/Expensicons';
import getReportActionContextMenuStyles from '../../../styles/getReportActionContextMenuStyles';
import {setNewMarkerPosition, updateLastReadActionID, saveReportActionDraft} from '../../../libs/actions/Report';
import {
setNewMarkerPosition, updateLastReadActionID, saveReportActionDraft, deleteReportComment,
} from '../../../libs/actions/Report';
import ReportActionContextMenuItem from './ReportActionContextMenuItem';
import ReportActionPropTypes from './ReportActionPropTypes';
import Clipboard from '../../../libs/Clipboard';
import compose from '../../../libs/compose';
import {isReportMessageAttachment} from '../../../libs/reportUtils';
import ONYXKEYS from '../../../ONYXKEYS';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import ConfirmModal from '../../../components/ConfirmModal';
import CONST from '../../../CONST';

const propTypes = {
/** The ID of the report this report action is attached to. */
Expand Down Expand Up @@ -63,8 +67,13 @@ class ReportActionContextMenu extends React.Component {
constructor(props) {
super(props);

this.confirmDeleteAndHideModal = this.confirmDeleteAndHideModal.bind(this);
this.hideDeleteConfirmModal = this.hideDeleteConfirmModal.bind(this);
this.getActionText = this.getActionText.bind(this);
this.canEdit = this.canEdit.bind(this);

// A list of all the context actions in this menu.
this.CONTEXT_ACTIONS = [
this.contextActions = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these being moved inside here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I kind of think that this should be set in the state and the view shouldn't display anything until these are set in the state (with an early return in the render method). I suggest something like this:

  1. All callbacks are changed to class methods and bound in the constructor
  2. contextActions is moved to the state and starts out empty
  3. In componentDidMount() use this.props to properly construct the contextActions and set them in the state

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these being moved inside here

So the callbacks can access the component's props.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

are you happy with this @tgolen?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is better yeah, but still not quite there yet. What I think we settled on in the other thread is:

  1. Move this.contextActions to be back at the top of the file outside of the class
  2. Change onPress={contextAction.onPress} to be onPress={() => contextAction.onPress(this.props)}
  3. Keep the callbacks defined as part of the contextActions object (no need to declare them as separate functions).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did do the change, like you requested, but this was reverted again when I merged main in, and it had the changes for edit comments where ReportActionContextMenu had been set as a class. I decided to leave as it was in main but happy to go back and move this.contextActions to be back at the top of the file outside of the class

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, thanks. I still think it would be good to move these back to be outside the class 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

sooooo, heh, sorry to keep commenting here, but are these going to be moved outside the class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, I can definetly do it, I'm a bit apreensive on doing that change, as I'm not sure if I'll be able to maintain some of the comments you and Rory have asked me to do. but let me give it a go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've done some changes to go in this direction, but I'm not entirely sure about them, feel there should be a better way to do this, there are so many calls to this and props that I ended up setting it as a method receiving the context menu. Let me know your thoughts.

// Copy to clipboard
{
text: this.props.translate('reportActionContextMenu.copyToClipboard'),
Expand Down Expand Up @@ -112,9 +121,10 @@ class ReportActionContextMenu extends React.Component {
{
text: this.props.translate('reportActionContextMenu.editComment'),
icon: Pencil,
shouldShow: this.props.reportAction.actorEmail === this.props.session.email
shouldShow: () => (
this.canEdit()
&& !isReportMessageAttachment(this.getActionText())
&& this.props.reportAction.reportActionID,
),
onPress: () => {
this.props.hidePopover();
saveReportActionDraft(
Expand All @@ -124,18 +134,19 @@ class ReportActionContextMenu extends React.Component {
);
},
},

{
text: this.props.translate('reportActionContextMenu.deleteComment'),
icon: Trashcan,
shouldShow: false,
onPress: () => {},
shouldShow: this.canEdit,
onPress: () => this.setState({isDeleteCommentConfirmModalVisible: true}),
},
];

this.wrapperStyle = getReportActionContextMenuStyles(this.props.isMini);

this.getActionText = this.getActionText.bind(this);
this.state = {
isDeleteCommentConfirmModalVisible: false,
};
}

/**
Expand All @@ -148,10 +159,33 @@ class ReportActionContextMenu extends React.Component {
return lodashGet(message, 'text', '');
}

/**
* Can the current user edit this report action?
*
* @return {Boolean}
*/
canEdit() {
// Can only edit if it's a ADDCOMMENT, the author is this user and it's not a optimistic response.
// If it's an optimistic response comment it will not have a reportActionID,
// and we should wait until it does before we show the actions
return this.props.reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT
&& this.props.reportAction.actorEmail === this.props.session.email
&& this.props.reportAction.reportActionID;
roryabraham marked this conversation as resolved.
Show resolved Hide resolved
}

confirmDeleteAndHideModal() {
deleteReportComment(this.props.reportID, this.props.reportAction);
this.setState({isDeleteCommentConfirmModalVisible: false});
}

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

render() {
return this.props.isVisible && (
<View style={this.wrapperStyle}>
{this.CONTEXT_ACTIONS.map(contextAction => contextAction.shouldShow && (
{this.contextActions.map(contextAction => _.result(contextAction, 'shouldShow', false) && (
<ReportActionContextMenuItem
icon={contextAction.icon}
text={contextAction.text}
Expand All @@ -162,6 +196,15 @@ class ReportActionContextMenu extends React.Component {
onPress={() => contextAction.onPress(this.props.reportAction)}
/>
))}
<ConfirmModal
title={this.props.translate('reportActionContextMenu.deleteComment')}
isVisible={this.state.isDeleteCommentConfirmModalVisible}
onConfirm={this.confirmDeleteAndHideModal}
onCancel={this.hideDeleteConfirmModal}
prompt={this.props.translate('reportActionContextMenu.deleteConfirmation')}
confirmText={this.props.translate('common.delete')}
cancelText={this.props.translate('common.cancel')}
/>
</View>
);
}
Expand Down
5 changes: 3 additions & 2 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import ReportActionItemIOUAction from '../../../components/ReportActionItemIOUAc
import ReportActionItemMessage from './ReportActionItemMessage';
import UnreadActionIndicator from '../../../components/UnreadActionIndicator';
import ReportActionItemMessageEdit from './ReportActionItemMessageEdit';
import CONST from '../../../CONST';

const propTypes = {
/** The ID of the report this action is on. */
Expand Down Expand Up @@ -197,7 +198,7 @@ class ReportActionItem extends Component {

render() {
let children;
if (this.props.action.actionName === 'IOU') {
if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU) {
children = (
<ReportActionItemIOUAction
chatReportID={this.props.reportID}
Expand All @@ -222,7 +223,7 @@ class ReportActionItem extends Component {
ref={el => this.popoverAnchor = el}
onSecondaryInteraction={this.showPopover}
>
<Hoverable>
<Hoverable resetsOnClickOutside={false}>
{hovered => (
<View>
{this.props.shouldDisplayNewIndicator && (
Expand Down
11 changes: 9 additions & 2 deletions src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,14 @@ class ReportActionsView extends React.Component {
updateSortedReportActions(reportActions) {
this.sortedReportActions = _.chain(reportActions)
.sortBy('sequenceNumber')
.filter(action => action.actionName === 'ADDCOMMENT' || action.actionName === 'IOU')
.filter((action) => {
// Only show non-empty ADDCOMMENT actions or IOU actions
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment does a good job of explaining "what" the code is doing, but not "why" it's doing it. The comment could be improved to explain why it's not showing any other actions.

// Empty ADDCOMMENT actions typically mean they have been deleted and should not be shown
const message = _.first(lodashGet(action, 'message', null));

This comment was marked as resolved.

const html = lodashGet(message, 'html', '');
return action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU
|| (action.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT && html !== '');
})
.map((item, index) => ({action: item, index}))
.value()
.reverse();
Expand Down Expand Up @@ -291,7 +298,7 @@ class ReportActionsView extends React.Component {
updateMostRecentIOUReportActionNumber(reportActions) {
this.mostRecentIOUReportSequenceNumber = _.chain(reportActions)
.sortBy('sequenceNumber')
.filter(action => action.actionName === 'IOU')
.filter(action => action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU)
.max(action => action.sequenceNumber)
.value().sequenceNumber;
}
Expand Down
3 changes: 2 additions & 1 deletion src/pages/iou/IOUTransactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import styles from '../../styles/styles';
import ONYXKEYS from '../../ONYXKEYS';
import ReportActionPropTypes from '../home/report/ReportActionPropTypes';
import ReportTransaction from '../../components/ReportTransaction';
import CONST from '../../CONST';

const propTypes = {
/** Actions from the ChatReport */
Expand All @@ -30,7 +31,7 @@ const IOUTransactions = ({
}) => (
<View style={[styles.mt3]}>
{_.map(reportActions, (reportAction) => {
if (reportAction.actionName === 'IOU'
if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU
&& reportAction.originalMessage.IOUReportID === iouReportID) {
return (
<ReportTransaction
Expand Down
3 changes: 2 additions & 1 deletion tests/actions/ReportTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {addAction, togglePinnedState, subscribeToUserEvents} from '../../src/lib
import waitForPromisesToResolve from '../utils/waitForPromisesToResolve';
import PushNotification from '../../src/libs/Notification/PushNotification';
import {signInWithTestUser, fetchPersonalDetailsForTestUser} from '../utils/TestHelper';
import CONST from '../../src/CONST';

PushNotification.register = () => {};
PushNotification.deregister = () => {};
Expand Down Expand Up @@ -42,7 +43,7 @@ describe('actions/Report', () => {
const REPORT_ID = 1;
const ACTION_ID = 1;
const REPORT_ACTION = {
actionName: 'ADDCOMMENT',
actionName: CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT,
actorAccountID: TEST_USER_ACCOUNT_ID,
actorEmail: TEST_USER_LOGIN,
automatic: false,
Expand Down