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

fix Reddot pinned chat appears for approver after failed scanned #39970

Merged
merged 20 commits into from
Jun 3, 2024
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
fix create isRequestor
  • Loading branch information
dukenv0307 committed May 27, 2024

Verified

This commit was signed with the committer’s verified signature.
BartoszGrajdek Bartosz Grajdek
commit 4c35a470baf64859d0e3954e22f8b511df5b6ccb
2 changes: 1 addition & 1 deletion src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
@@ -508,7 +508,7 @@ function getAllReportErrors(report: OnyxEntry<Report>, reportActions: OnyxEntry<
const parentReportAction: OnyxEntry<ReportAction> =
!report?.parentReportID || !report?.parentReportActionID ? null : allReportActions?.[report.parentReportID ?? '']?.[report.parentReportActionID ?? ''] ?? null;

if (parentReportAction?.actorAccountID === currentUserAccountID && ReportActionUtils.isTransactionThread(parentReportAction)) {
if (ReportActionUtils.isRequestor(parentReportAction) && ReportActionUtils.isTransactionThread(parentReportAction)) {
const transactionID = parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? parentReportAction?.originalMessage?.IOUTransactionID : null;
const transaction = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`];
if (TransactionUtils.hasMissingSmartscanFields(transaction ?? null) && !ReportUtils.isSettled(transaction?.reportID)) {
8 changes: 8 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
@@ -1199,6 +1199,13 @@ function isLinkedTransactionHeld(reportActionID: string, reportID: string): bool
return TransactionUtils.isOnHoldByTransactionID(getLinkedTransactionID(reportActionID, reportID) ?? '');
}

/**
* Check if the current user is the requestor of the action
*/
function isRequestor(reportAction: OnyxEntry<ReportAction>): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I kinda missed this in the proposal and original review, but I was thinking about reports when thinking about isRequestor, but for report actions, this name isn't great.

How about we call this something like ReportActionUtils.actionWasTakenByCurrentUser(reportAction)

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 renamed it in commit

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool, let me know when this is ready for re-review. Thanks

return currentUserAccountID === reportAction?.actorAccountID;
}

export {
extractLinksFromMessageHtml,
getDismissedViolationMessageText,
@@ -1266,6 +1273,7 @@ export {
isActionableTrackExpense,
getAllReportActions,
isLinkedTransactionHeld,
isRequestor,
};

export type {LastVisibleMessage};
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
@@ -2767,7 +2767,7 @@ function shouldShowRBRForMissingSmartscanFields(iouReportID: string): boolean {
if (isEmptyObject(transaction)) {
return false;
}
if (currentUserAccountID !== action?.actorAccountID) {
if (!ReportActionsUtils.isRequestor(action)) {
return false;
}
return TransactionUtils.hasMissingSmartscanFields(transaction);