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

Remove the hasOutstandingIOU key #32653

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e76adc4
redesign page
rezkiy37 Dec 1, 2023
6963583
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 Dec 2, 2023
f969c88
remove body2
rezkiy37 Dec 2, 2023
1207fd8
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 Dec 4, 2023
4d91e45
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 Dec 5, 2023
8baed2d
update strings
rezkiy37 Dec 5, 2023
c378ca3
rename key
rezkiy37 Dec 5, 2023
588b8a5
update es strings
rezkiy37 Dec 5, 2023
908885f
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fea…
rezkiy37 Dec 6, 2023
b647eca
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Dec 7, 2023
b2aae83
remove hasOutstandingIOU from MoneyRequestAction
rezkiy37 Dec 7, 2023
f867e8b
remove hasOutstandingIOU from updateIOUOwnerAndTotal
rezkiy37 Dec 7, 2023
eeab94c
remove hasOutstandingIOU from createOption
rezkiy37 Dec 7, 2023
066b288
remove hasOutstandingIOU from hasNonReimbursableTransactions
rezkiy37 Dec 7, 2023
506f306
remove hasOutstandingIOU from getMoneyRequestSpendBreakdown
rezkiy37 Dec 7, 2023
c80a014
remove hasOutstandingIOU from getMoneyRequestReportName
rezkiy37 Dec 7, 2023
061d10e
remove hasOutstandingIOU from getOptionData
rezkiy37 Dec 7, 2023
57e5fa4
remove hasOutstandingIOU from MoneyRequestAction
rezkiy37 Dec 7, 2023
1148659
revert changes
rezkiy37 Dec 7, 2023
5cba622
fix tests
rezkiy37 Dec 7, 2023
bef52ad
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Dec 8, 2023
fe544e2
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Dec 8, 2023
e2481b5
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
rezkiy37 Dec 11, 2023
f8a8381
remove hasOutstandingIOU from src
rezkiy37 Dec 11, 2023
ad9d3c2
remove hasOutstandingIOU from tests
rezkiy37 Dec 11, 2023
9939213
integrate isProcessingReport helper
rezkiy37 Dec 11, 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
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/MoneyRequestAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function MoneyRequestAction({
if (
!_.isEmpty(iouReport) &&
!_.isEmpty(reportActions) &&
chatReport.hasOutstandingIOU &&
chatReport.iouReportID &&
isMostRecentIOUReportAction &&
action.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD &&
network.isOffline
Expand Down
3 changes: 0 additions & 3 deletions src/components/ReportActionItem/MoneyRequestPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ const propTypes = {

/** Currency of outstanding amount of this transaction */
currency: PropTypes.string,

/** Does the iouReport have an outstanding IOU? */
hasOutstandingIOU: PropTypes.bool,
}),

/** True if this is this IOU is a split instead of a 1:1 request */
Expand Down
3 changes: 0 additions & 3 deletions src/components/ReportActionItem/ReportPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ const propTypes = {
/** Currency of outstanding amount of this transaction */
currency: PropTypes.string,

/** Does the iouReport have an outstanding IOU? */
hasOutstandingIOU: PropTypes.bool,

/** Is the iouReport waiting for the submitter to add a credit bank account? */
isWaitingOnBankAccount: PropTypes.bool,
}),
Expand Down
3 changes: 0 additions & 3 deletions src/components/optionPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ export default PropTypes.shape({
// Whether the report corresponds to a chat room
isChatRoom: PropTypes.bool,

// Whether the option has an outstanding IOU
hasOutstandingIOU: PropTypes.bool,

// Custom icon to render on the right side of the option
customIcon: PropTypes.shape({
// The icon source
Expand Down
27 changes: 0 additions & 27 deletions src/libs/E2E/apiMocks/openApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,6 @@ const openApp = (): Response => ({
'<a href="mailto:[email protected]" target="_blank" rel="noreferrer noopener">[email protected]</a>. Learn more ' +
'<a href="https://www.expensify.com/inbox?policyID=C28C2634DD7226B8&amp;taskID=ForwardToExpensifyCash" target="_blank" rel="noreferrer noopener">here.' +
'</a> For questions, just reply to this message.',
hasOutstandingIOU: false,
},
report_98258458: {
reportID: '98258458',
Expand All @@ -1549,7 +1548,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: true,
lastMessageHtml: '',
hasOutstandingIOU: false,
},
report_98344717: {
reportID: '98344717',
Expand All @@ -1571,7 +1569,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Requested \u20b41.67 from [email protected]',
hasOutstandingIOU: false,
},
report_98345050: {
reportID: '98345050',
Expand All @@ -1593,7 +1590,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Cancelled the \u20b440.00 request',
hasOutstandingIOU: false,
},
report_98345315: {
reportID: '98345315',
Expand All @@ -1615,7 +1611,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: '<a href="mailto:[email protected]">[email protected]</a>',
hasOutstandingIOU: false,
},
report_98345625: {
reportID: '98345625',
Expand All @@ -1637,7 +1632,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Say hello\ud83d\ude10',
hasOutstandingIOU: false,
},
report_98345679: {
reportID: '98345679',
Expand All @@ -1659,7 +1653,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: true,
lastMessageHtml: '',
hasOutstandingIOU: false,
},
report_98414813: {
reportID: '98414813',
Expand All @@ -1681,7 +1674,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Split \u20b45.00 with [email protected] and [email protected]',
hasOutstandingIOU: false,
},
report_98817646: {
reportID: '98817646',
Expand All @@ -1703,7 +1695,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'RR',
hasOutstandingIOU: true,
iouReportID: '2543745284790730',
},
report_358751490033727: {
Expand All @@ -1726,7 +1717,6 @@ const openApp = (): Response => ({
visibility: 'restricted',
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'STAGING_CHAT_MESSAGE_A2C534B7-3509-416E-A0AD-8463831C29DD',
hasOutstandingIOU: false,
},
report_663424408122117: {
reportID: '663424408122117',
Expand All @@ -1748,7 +1738,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: '',
hasOutstandingIOU: false,
},
report_944123936554214: {
reportID: '944123936554214',
Expand All @@ -1770,7 +1759,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: true,
lastMessageHtml: '',
hasOutstandingIOU: false,
},
report_2242399088152511: {
reportID: '2242399088152511',
Expand All @@ -1792,7 +1780,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: '<p>Hi there, thanks for reaching out! How may I help?</p>',
hasOutstandingIOU: false,
},
report_2576922422943214: {
reportID: '2576922422943214',
Expand All @@ -1814,7 +1801,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Test',
hasOutstandingIOU: false,
},
report_2752461403207161: {
reportID: '2752461403207161',
Expand All @@ -1836,7 +1822,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: '',
hasOutstandingIOU: false,
},
report_3785654888638968: {
reportID: '3785654888638968',
Expand All @@ -1858,7 +1843,6 @@ const openApp = (): Response => ({
visibility: 'restricted',
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Room renamed to #jack',
hasOutstandingIOU: false,
},
report_4867098979334014: {
reportID: '4867098979334014',
Expand All @@ -1880,7 +1864,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Requested \u20ac200.00 from Christoph for Essen mit Kunden',
hasOutstandingIOU: true,
iouReportID: '4249286573496381',
},
report_5277760851229035: {
Expand All @@ -1905,7 +1888,6 @@ const openApp = (): Response => ({
lastMessageHtml:
'fff<br />f<br />f<br />f<br />f<br />f<br />f<br />f<br />f<br /><br />f<br />f<br />f<br />f<br /><br />f<br />' +
'f<br />f<br />f<br />f<br />f<br /><br />f<br />f<br />f<br />f<br />f<br />ff',
hasOutstandingIOU: false,
},
report_5324367938904284: {
reportID: '5324367938904284',
Expand All @@ -1927,7 +1909,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Iviviviv8b',
hasOutstandingIOU: false,
},
report_5654270288238256: {
reportID: '5654270288238256',
Expand All @@ -1949,7 +1930,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: '',
hasOutstandingIOU: false,
},
report_6194900075541844: {
reportID: '6194900075541844',
Expand All @@ -1971,7 +1951,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: '',
hasOutstandingIOU: false,
},
report_6801643744224146: {
reportID: '6801643744224146',
Expand All @@ -1994,7 +1973,6 @@ const openApp = (): Response => ({
isOwnPolicyExpenseChat: false,
lastMessageHtml:
"\ud83d\udc4b Welcome to Expensify! I'm Concierge. Is there anything I can help with? Click the + icon on the homescreen to explore the features you can use.",
hasOutstandingIOU: false,
},
report_7658708888047100: {
reportID: '7658708888047100',
Expand All @@ -2016,7 +1994,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Hi there! How can I help?\u00a0',
hasOutstandingIOU: false,
},
report_7756405299640824: {
reportID: '7756405299640824',
Expand All @@ -2038,7 +2015,6 @@ const openApp = (): Response => ({
visibility: 'restricted',
isOwnPolicyExpenseChat: false,
lastMessageHtml: 'Room renamed to #jackd23',
hasOutstandingIOU: false,
},
report_7819732651025410: {
reportID: '7819732651025410',
Expand All @@ -2060,7 +2036,6 @@ const openApp = (): Response => ({
visibility: null,
isOwnPolicyExpenseChat: false,
lastMessageHtml: '',
hasOutstandingIOU: false,
},
report_2543745284790730: {
reportID: '2543745284790730',
Expand All @@ -2072,7 +2047,6 @@ const openApp = (): Response => ({
cachedTotal: '($1,473.11)',
total: 147311,
stateNum: 1,
hasOutstandingIOU: true,
},
report_4249286573496381: {
reportID: '4249286573496381',
Expand All @@ -2084,7 +2058,6 @@ const openApp = (): Response => ({
cachedTotal: '($212.78)',
total: 21278,
stateNum: 1,
hasOutstandingIOU: true,
},
},
},
Expand Down
1 change: 0 additions & 1 deletion src/libs/E2E/apiMocks/openReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export default (): Response => ({
isOwnPolicyExpenseChat: false,
lastMessageHtml: '[email protected] owes \u20ac12.00',
iouReportID: '206636935813547',
hasOutstandingIOU: false,
hasOutstandingChildRequest: false,
policyName: null,
hasParentAccess: null,
Expand Down
2 changes: 0 additions & 2 deletions src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ function updateIOUOwnerAndTotal(iouReport: OnyxEntry<Report>, actorAccountID: nu
iouReportUpdate.managerID = iouReport.ownerAccountID;
iouReportUpdate.total = -iouReportUpdate.total;
}

iouReportUpdate.hasOutstandingIOU = iouReportUpdate.total !== 0;
}

return iouReportUpdate;
Expand Down
2 changes: 0 additions & 2 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, {
searchText: null,
isDefaultRoom: false,
isPinned: false,
hasOutstandingIOU: false,
isWaitingOnBankAccount: false,
iouReportID: null,
isIOUReportOwner: null,
Expand Down Expand Up @@ -503,7 +502,6 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, {
result.iouReportID = report.iouReportID;
result.keyForList = String(report.reportID);
result.tooltipText = ReportUtils.getReportParticipantsTitle(report.participantAccountIDs || []);
result.hasOutstandingIOU = report.hasOutstandingIOU;
result.isWaitingOnBankAccount = report.isWaitingOnBankAccount;
result.policyID = report.policyID;

Expand Down
21 changes: 11 additions & 10 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ type OptimisticExpenseReport = Pick<
| 'policyID'
| 'type'
| 'ownerAccountID'
| 'hasOutstandingIOU'
| 'currency'
| 'reportName'
| 'state'
Expand Down Expand Up @@ -197,7 +196,6 @@ type OptimisticChatReport = Pick<
Report,
| 'type'
| 'chatType'
| 'hasOutstandingIOU'
| 'isOwnPolicyExpenseChat'
| 'isPinned'
| 'lastActorAccountID'
Expand Down Expand Up @@ -297,7 +295,6 @@ type TransactionDetails =
type OptimisticIOUReport = Pick<
Report,
| 'cachedTotal'
| 'hasOutstandingIOU'
| 'type'
| 'chatReportID'
| 'currency'
Expand Down Expand Up @@ -751,6 +748,13 @@ function isConciergeChatReport(report: OnyxEntry<Report>): boolean {
return report?.participantAccountIDs?.length === 1 && Number(report.participantAccountIDs?.[0]) === CONST.ACCOUNT_ID.CONCIERGE && !isChatThread(report);
}

/**
* Returns true if report is still being processed
*/
function isProcessingReport(report: OnyxEntry<Report>): boolean {
return report?.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && report?.statusNum === CONST.REPORT.STATUS.SUBMITTED;
}

/**
* Check if the report is a single chat report that isn't a thread
* and personal detail of participant is optimistic data
Expand Down Expand Up @@ -1612,7 +1616,7 @@ function getMoneyRequestReimbursableTotal(report: OnyxEntry<Report>, allReportsD
if (isMoneyRequestReport(report)) {
moneyRequestReport = report;
}
if (allAvailableReports && report?.hasOutstandingIOU && report?.iouReportID) {
if (allAvailableReports && report?.iouReportID) {
moneyRequestReport = allAvailableReports[`${ONYXKEYS.COLLECTION.REPORT}${report.iouReportID}`];
}
if (moneyRequestReport) {
Expand All @@ -1634,7 +1638,7 @@ function getMoneyRequestSpendBreakdown(report: OnyxEntry<Report>, allReportsDict
if (isMoneyRequestReport(report)) {
moneyRequestReport = report;
}
if (allAvailableReports && report?.hasOutstandingIOU && report?.iouReportID) {
if (allAvailableReports && report?.iouReportID) {
moneyRequestReport = allAvailableReports[`${ONYXKEYS.COLLECTION.REPORT}${report.iouReportID}`];
}
if (moneyRequestReport) {
Expand Down Expand Up @@ -1728,7 +1732,7 @@ function getMoneyRequestReportName(report: OnyxEntry<Report>, policy: OnyxEntry<
return Localize.translateLocal('iou.payerSpentAmount', {payer: payerName, amount: formattedAmount});
}

if (!!report?.hasOutstandingIOU || isDraftExpenseReport(report) || moneyRequestTotal === 0) {
if (isProcessingReport(report) || isDraftExpenseReport(report) || moneyRequestTotal === 0) {
return Localize.translateLocal('iou.payerOwesAmount', {payer: payerName, amount: formattedAmount});
}

Expand Down Expand Up @@ -2553,8 +2557,6 @@ function buildOptimisticIOUReport(payeeAccountID: number, payerAccountID: number
const personalDetails = getPersonalDetailsForAccountID(payerAccountID);
const payerEmail = 'login' in personalDetails ? personalDetails.login : '';
return {
// If we're sending money, hasOutstandingIOU should be false
hasOutstandingIOU: !isSendingMoney,
type: CONST.REPORT.TYPE.IOU,
cachedTotal: formattedTotal,
chatReportID,
Expand Down Expand Up @@ -2608,7 +2610,6 @@ function buildOptimisticExpenseReport(chatReportID: string, policyID: string, pa
policyID,
type: CONST.REPORT.TYPE.EXPENSE,
ownerAccountID: payeeAccountID,
hasOutstandingIOU: true,
currency: outputCurrency,

// We don't translate reportName because the server response is always in English
Expand Down Expand Up @@ -3087,7 +3088,6 @@ function buildOptimisticChatReport(
return {
type: CONST.REPORT.TYPE.CHAT,
chatType,
hasOutstandingIOU: false,
isOwnPolicyExpenseChat,
isPinned: reportName === CONST.REPORT.WORKSPACE_CHAT_ROOMS.ADMINS || isNewlyCreatedWorkspaceChat,
lastActorAccountID: 0,
Expand Down Expand Up @@ -4346,6 +4346,7 @@ export {
isPublicRoom,
isPublicAnnounceRoom,
isConciergeChatReport,
isProcessingReport,
isCurrentUserTheOnlyParticipant,
hasAutomatedExpensifyAccountIDs,
hasExpensifyGuidesEmails,
Expand Down
Loading
Loading