Skip to content

Commit

Permalink
Merge branch 'fix-21719' of github.com:hungvu193/App into fix-21719
Browse files Browse the repository at this point in the history
  • Loading branch information
hungvu193 committed Jul 4, 2023
2 parents 824b7b2 + 5cc07e0 commit 0a05097
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import isReportMessageAttachment from './isReportMessageAttachment';
import * as defaultWorkspaceAvatars from '../components/Icon/WorkspaceDefaultAvatars';
import * as CurrencyUtils from './CurrencyUtils';
import * as UserUtils from './UserUtils';
import * as ReportUtils from './ReportUtils';

let currentUserEmail;
let currentUserAccountID;
Expand Down Expand Up @@ -212,26 +211,6 @@ function canEditReportAction(reportAction) {
);
}

/**
* Can only flag if:
*
* - It was written by someone else
* - It's an ADDCOMMENT that is not an attachment
*
* @param {Object} reportAction
* @param {number} reportID
* @returns {Boolean}
*/
function canFlagReportAction(reportAction, reportID) {
return (
!loginList.includes(reportAction.actorEmail) &&
reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT &&
!ReportActionsUtils.isDeletedAction(reportAction) &&
!ReportActionsUtils.isCreatedTaskReportAction(reportAction) &&
ReportUtils.isAllowedToComment(ReportUtils.getReport(reportID))
);
}

/**
* Whether the Money Request report is settled
*
Expand Down Expand Up @@ -2091,6 +2070,26 @@ function chatIncludesChronos(report) {
return report.participantAccountIDs && _.contains(report.participantAccountIDs, CONST.ACCOUNT_ID.CHRONOS);
}

/**
* Can only flag if:
*
* - It was written by someone else
* - It's an ADDCOMMENT that is not an attachment
*
* @param {Object} reportAction
* @param {number} reportID
* @returns {Boolean}
*/
function canFlagReportAction(reportAction, reportID) {
return (
!loginList.includes(reportAction.actorEmail) &&
reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT &&
!ReportActionsUtils.isDeletedAction(reportAction) &&
!ReportActionsUtils.isCreatedTaskReportAction(reportAction) &&
isAllowedToComment(getReport(reportID))
);
}

/**
* Whether flag comment page should show
*
Expand Down

0 comments on commit 0a05097

Please sign in to comment.