Skip to content

Commit

Permalink
fix: cannot edit money request transaction in offline
Browse files Browse the repository at this point in the history
  • Loading branch information
tienifr committed Sep 12, 2023
1 parent 1164b34 commit 30e7690
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import isReportMessageAttachment from './isReportMessageAttachment';
import * as defaultWorkspaceAvatars from '../components/Icon/WorkspaceDefaultAvatars';
import * as CurrencyUtils from './CurrencyUtils';
import * as UserUtils from './UserUtils';
import {isDeletedAction} from './ReportActionsUtils';

let currentUserEmail;
let currentUserAccountID;
Expand Down Expand Up @@ -1314,7 +1315,7 @@ function canEditMoneyRequest(reportAction) {
const isReportSettled = isSettled(moneyRequestReport.reportID);
const isAdmin = isExpenseReport(moneyRequestReport) && lodashGet(getPolicy(moneyRequestReport.policyID), 'role', '') === CONST.POLICY.ROLE.ADMIN;
const isRequestor = currentUserAccountID === reportAction.actorAccountID;
return !isReportSettled && (isAdmin || isRequestor);
return !isReportSettled && !isDeletedAction(reportAction) && (isAdmin || isRequestor);
}

/**
Expand Down Expand Up @@ -2622,7 +2623,7 @@ function buildTransactionThread(reportAction, moneyRequestReportID) {
participantAccountIDs,
getTransactionReportName(reportAction),
'',
lodashGet(getReport(reportAction.reportID), 'policyID', CONST.POLICY.OWNER_EMAIL_FAKE),
lodashGet(getReport(moneyRequestReportID), 'policyID', CONST.POLICY.OWNER_EMAIL_FAKE),
CONST.POLICY.OWNER_ACCOUNT_ID_FAKE,
false,
'',
Expand Down

0 comments on commit 30e7690

Please sign in to comment.