Skip to content

Commit

Permalink
Fix ArrowUp editing
Browse files Browse the repository at this point in the history
  • Loading branch information
roryabraham committed Jan 25, 2023
1 parent 21486cd commit 83471a0
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,36 +114,31 @@ function sortReportsByLastRead(reports) {
}

/**
* Can only edit if it's an ADDCOMMENT that is not an attachment,
* the author is this user and it's not an 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
* Can only edit if:
*
* - It was written by the current user
* - It's an ADDCOMMENT that is not an attachment
* - It's not pending deletion
*
* @param {Object} reportAction
* @returns {Boolean}
*/
function canEditReportAction(reportAction) {
return reportAction.actorEmail === sessionEmail
&& reportAction.reportActionID
&& reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT
&& !isReportMessageAttachment(lodashGet(reportAction, ['message', 0], {}))
&& reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD
&& reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
}

/**
* Can only delete if it's an ADDCOMMENT, the author is this user and it's not an 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
* Can only delete if it's an ADDCOMMENT, the author is this user.
*
* @param {Object} reportAction
* @returns {Boolean}
*/
function canDeleteReportAction(reportAction) {
return reportAction.actorEmail === sessionEmail
&& reportAction.reportActionID
&& reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT
&& reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD
&& reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
}

Expand Down

0 comments on commit 83471a0

Please sign in to comment.