Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
grgia committed Oct 29, 2024
1 parent b029e64 commit 69ad164
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2298,7 +2298,7 @@ function getIcons(
if (isChatThread(report)) {
const parentReportAction = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`]?.[report.parentReportActionID];

const actorAccountID = getReportActionActorAccountID(parentReportAction, report);
const actorAccountID = getReportActionActorAccountID(parentReportAction, report, report);
const actorDisplayName = PersonalDetailsUtils.getDisplayNameOrDefault(allPersonalDetails?.[actorAccountID ?? -1], '', false);
const actorIcon = {
id: actorAccountID,
Expand Down Expand Up @@ -8037,13 +8037,13 @@ function canLeaveChat(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>): boo
function getReportActionActorAccountID(
reportAction: OnyxInputOrEntry<ReportAction>,
iouReport: OnyxInputOrEntry<Report> | undefined,
isPolicyExpenseChatParam: boolean | undefined,
report: OnyxInputOrEntry<Report> | undefined,
): number | undefined {
switch (reportAction?.actionName) {
case CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW: {
const ownerAccountID = iouReport?.ownerAccountID ?? reportAction?.childOwnerAccountID;
const actorAccountID = iouReport?.managerID ?? reportAction?.childManagerAccountID;
return isPolicyExpenseChatParam ? ownerAccountID : actorAccountID;
return isPolicyExpenseChat(report) ? ownerAccountID : actorAccountID;
}

case CONST.REPORT.ACTIONS.TYPE.SUBMITTED:
Expand All @@ -8053,7 +8053,6 @@ function getReportActionActorAccountID(
return reportAction?.actorAccountID;
}
}

function createDraftWorkspaceAndNavigateToConfirmationScreen(transactionID: string, actionName: IOUAction): void {
const isCategorizing = actionName === CONST.IOU.ACTION.CATEGORIZE;
const {expenseChatReportID, policyID, policyName} = PolicyActions.createDraftWorkspace();
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionItemSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function ReportActionItemSingle({
const delegatePersonalDetails = personalDetails[action?.delegateAccountID ?? ''];
const ownerAccountID = iouReport?.ownerAccountID ?? action?.childOwnerAccountID;
const isReportPreviewAction = action?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW;
const actorAccountID = ReportUtils.getReportActionActorAccountID(action, iouReport, ReportUtils.isPolicyExpenseChat(report));
const actorAccountID = ReportUtils.getReportActionActorAccountID(action, iouReport, report);
const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : -1}`);

let displayName = ReportUtils.getDisplayNameForParticipant(actorAccountID);
Expand Down

0 comments on commit 69ad164

Please sign in to comment.