Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Abdelhafidh Belalia <[email protected]>
  • Loading branch information
youssef-lr and s77rt authored Oct 11, 2023
1 parent e3dc941 commit 45d90fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ export default {
},
EDIT_SPLIT_BILL: {
route: `r/:reportID/split/:reportActionID/edit/:field`,
getRoute: (reportID: number, reportActionID: number, field: ValueOf<typeof CONST.EDIT_REQUEST_FIELD>) => `r/${reportID}/split/${reportActionID}/edit/${field}`,
getRoute: (reportID: string, reportActionID: string, field: ValueOf<typeof CONST.EDIT_REQUEST_FIELD>) => `r/${reportID}/split/${reportActionID}/edit/${field}`,
},
EDIT_SPLIT_BILL_CURRENCY: {
route: 'r/:reportID/split/:reportActionID/edit/currency',
getRoute: (reportID: number, reportActionID: number, currency: string, backTo: string) => `r/${reportID}/split/${reportActionID}/edit/currency?currency=${currency}&backTo=${backTo}`,
getRoute: (reportID: string, reportActionID: string, currency: string, backTo: string) => `r/${reportID}/split/${reportActionID}/edit/currency?currency=${currency}&backTo=${backTo}`,
},
TASK_TITLE: {
route: 'r/:reportID/title',
Expand Down
13 changes: 4 additions & 9 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ Onyx.connect({
key: ONYXKEYS.COLLECTION.DRAFT_SPLIT_TRANSACTION,
waitForCollectionCallback: true,
callback: (val) => {
if (!val) {
allDraftSplitTransactions = {};
return;
}

allDraftSplitTransactions = val;
allDraftSplitTransactions = val || {};
},
});

Expand Down Expand Up @@ -1564,7 +1559,7 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, curre
const splits = [];
_.each(splitParticipants, (participant) => {
// Skip creating the transaction for the current user
if (participant.email && participant.email === currentUserEmail) {
if (participant.email === currentUserEmailForIOUSplit) {
return;
}
const isPolicyExpenseChat = !_.isEmpty(participant.policyID);
Expand Down Expand Up @@ -1612,7 +1607,7 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, curre
isPolicyExpenseChat ? -splitAmount : splitAmount,
currency,
oneOnOneIOUReport.reportID,
updatedTransaction.comment,
updatedTransaction.comment.comment,
updatedTransaction.modifiedCreated,
CONST.IOU.MONEY_REQUEST_TYPE.SPLIT,
updatedTransaction.transactionID,
Expand All @@ -1627,7 +1622,7 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, curre
CONST.IOU.REPORT_ACTION_TYPE.CREATE,
splitAmount,
currency,
updatedTransaction.modifiedComment,
updatedTransaction.comment.comment,
[participant],
oneOnOneTransaction.transactionID,
'',
Expand Down
6 changes: 3 additions & 3 deletions src/pages/EditSplitBillPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const propTypes = {
field: PropTypes.string,

/** reportID for the "transaction thread" */
threadReportID: PropTypes.string,
reportActionID: PropTypes.string,
}),
}).isRequired,

Expand Down Expand Up @@ -88,12 +88,12 @@ function EditSplitBillPage({report, route, transactions, draftSplitTransactions}
<EditRequestDescriptionPage
defaultDescription={transactionDescription}
onSubmit={(transactionChanges) => {
if (transactionChanges.comment === transactionDescription) {
if (transactionChanges.comment.trim() === transactionDescription) {
Navigation.dismissModal();
return;
}
setDraftSplitTransaction({
comment: transactionChanges.comment,
comment: transactionChanges.comment.trim(),
});
}}
/>
Expand Down

0 comments on commit 45d90fb

Please sign in to comment.