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

Feat: Update how GBR is determined for IOU/expense reports #30655

Merged
merged 27 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cb3f3d0
add hasOutstandingChildRequest verification
waterim Oct 17, 2023
ddba0ec
adjusted and removed unused parts
waterim Oct 18, 2023
4fca049
clean up show GBR
waterim Oct 20, 2023
7523bd6
Merge remote-tracking branch 'upstream/main' into feat-29595-Update-G…
waterim Oct 20, 2023
b8b6752
Merge remote-tracking branch 'upstream/main' into feat-29595-Update-G…
waterim Oct 23, 2023
f6b79e6
tests
waterim Oct 24, 2023
f4cb009
fix lint
waterim Oct 24, 2023
63f6bd8
tests fix
waterim Oct 24, 2023
647efb8
updated text
waterim Oct 25, 2023
de9e121
fix GBR display
waterim Oct 27, 2023
2bb9228
Merge remote-tracking branch 'upstream/main' into feat-29595-Update-G…
waterim Oct 27, 2023
bfb06ae
changes
waterim Oct 27, 2023
a9c9ef2
remove iou ordering
waterim Oct 30, 2023
0ce0891
lint fix
waterim Oct 30, 2023
dd4a7bb
Merge remote-tracking branch 'upstream/main' into feat-29595-Update-G…
waterim Oct 30, 2023
c79c9f1
Add task logic to shouldShowGBR
puneetlath Oct 31, 2023
c497922
Use or instead of null coalescing in getOrderedReportIDs
puneetlath Oct 31, 2023
8e1ad6d
Update pinned logic for linter
puneetlath Oct 31, 2023
1195a83
Add tests for various shouldShowGBR cases
puneetlath Oct 31, 2023
3e938c6
Remove unneeded import
puneetlath Oct 31, 2023
056b7d5
Update comment about pinned/gbr reports
puneetlath Oct 31, 2023
943bc80
Rename functions to separate UI from function logic
puneetlath Oct 31, 2023
d6eff10
Update src/libs/ReportUtils.js
puneetlath Oct 31, 2023
fb9b40d
Rename shouldShowGBR to requiresAttentionFromCurrentUser in tests
puneetlath Oct 31, 2023
cc74887
Rename shouldShowGBR in one more place
puneetlath Oct 31, 2023
b35d1da
Rename report to option in requiresAttentionFromCurrentUser
puneetlath Oct 31, 2023
efcefdb
Account for both options and reports in unread check
puneetlath Oct 31, 2023
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
tests
  • Loading branch information
waterim committed Oct 24, 2023
commit f6b79e6baf4a2f3d044c7c810c644177ada2ac5a
1 change: 1 addition & 0 deletions src/pages/home/sidebar/SidebarLinksData.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const chatReportSelector = (report) =>
total: report.total,
nonReimbursableTotal: report.nonReimbursableTotal,
hasOutstandingIOU: report.hasOutstandingIOU,
hasOutstandingChildRequest: report.hasOutstandingChildRequest,
isWaitingOnBankAccount: report.isWaitingOnBankAccount,
statusNum: report.statusNum,
stateNum: report.stateNum,
Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ type Report = {
/** Whether there is an outstanding amount in IOU */
hasOutstandingIOU?: boolean;

/** Whether child has an outstanding request */
hasOutstandingChildRequest?: boolean;

/** List of icons for report participants */
icons?: OnyxCommon.Icon[];

Expand Down
28 changes: 14 additions & 14 deletions tests/unit/SidebarOrderTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@
};
const report3 = {
...LHNTestUtils.getFakeReport([5, 6], 1),
hasOutstandingIOU: false,
hasOutstandingChildRequest: false,

// This has to be added after the IOU report is generated
iouReportID: null,
Expand All @@ -395,7 +395,7 @@
type: CONST.REPORT.TYPE.IOU,
ownerAccountID: 2,
managerID: 2,
hasOutstandingIOU: true,
hasOutstandingChildRequest: true,
total: 10000,
currency: 'USD',
chatReportID: report3.reportID,
Expand All @@ -404,7 +404,7 @@
const currentReportId = report2.reportID;
const currentlyLoggedInUserAccountID = 9;
LHNTestUtils.getDefaultRenderedSidebarLinks(currentReportId);

console.log('iouReport :>> ', iouReport);

Check failure on line 407 in tests/unit/SidebarOrderTest.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
return (
waitForBatchedUpdates()
// When Onyx is updated with the data and the sidebar re-renders
Expand All @@ -431,7 +431,7 @@
expect(screen.queryAllByTestId('Pin Icon')).toHaveLength(1);
expect(screen.queryAllByTestId('Pencil Icon')).toHaveLength(1);
expect(lodashGet(displayNames, [0, 'props', 'children'])).toBe('One, Two');
expect(lodashGet(displayNames, [1, 'props', 'children'])).toBe('Email Two owes $100.00');
expect(lodashGet(displayNames, [1, 'props', 'children'])).toBe('Email Two paid $100.00');
expect(lodashGet(displayNames, [2, 'props', 'children'])).toBe('Three, Four');
})
);
Expand Down Expand Up @@ -733,7 +733,7 @@
type: CONST.REPORT.TYPE.IOU,
ownerAccountID: 2,
managerID: 2,
hasOutstandingIOU: true,
hasOutstandingChildRequest: true,
total: 10000,
currency: 'USD',
chatReportID: report3.reportID,
Expand All @@ -743,7 +743,7 @@
type: CONST.REPORT.TYPE.IOU,
ownerAccountID: 2,
managerID: 3,
hasOutstandingIOU: true,
hasOutstandingChildRequest: true,
total: 10000,
currency: 'USD',
chatReportID: report3.reportID,
Expand All @@ -753,7 +753,7 @@
type: CONST.REPORT.TYPE.IOU,
ownerAccountID: 2,
managerID: 4,
hasOutstandingIOU: true,
hasOutstandingChildRequest: true,
total: 100000,
currency: 'USD',
chatReportID: report3.reportID,
Expand All @@ -763,7 +763,7 @@
type: CONST.REPORT.TYPE.IOU,
ownerAccountID: 2,
managerID: 5,
hasOutstandingIOU: true,
hasOutstandingChildRequest: true,
total: 10000,
currency: 'USD',
chatReportID: report3.reportID,
Expand All @@ -773,7 +773,7 @@
type: CONST.REPORT.TYPE.IOU,
ownerAccountID: 2,
managerID: 6,
hasOutstandingIOU: true,
hasOutstandingChildRequest: true,
total: 10000,
currency: 'USD',
chatReportID: report3.reportID,
Expand Down Expand Up @@ -814,11 +814,11 @@
const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames');
const displayNames = screen.queryAllByLabelText(hintText);
expect(displayNames).toHaveLength(5);
expect(lodashGet(displayNames, [0, 'props', 'children'])).toBe('Email Four owes $1,000.00');
expect(lodashGet(displayNames, [1, 'props', 'children'])).toBe('Email Five owes $100.00');
expect(lodashGet(displayNames, [2, 'props', 'children'])).toBe('Email Six owes $100.00');
expect(lodashGet(displayNames, [3, 'props', 'children'])).toBe('Email Three owes $100.00');
expect(lodashGet(displayNames, [4, 'props', 'children'])).toBe('Email Two owes $100.00');
expect(lodashGet(displayNames, [0, 'props', 'children'])).toBe('Email Four paid $1,000.00');
expect(lodashGet(displayNames, [1, 'props', 'children'])).toBe('Email Five paid $100.00');
expect(lodashGet(displayNames, [2, 'props', 'children'])).toBe('Email Six paid $100.00');
expect(lodashGet(displayNames, [3, 'props', 'children'])).toBe('Email Three paid $100.00');
expect(lodashGet(displayNames, [4, 'props', 'children'])).toBe('Email Two paid $100.00');
})
);
});
Expand Down
Loading