Skip to content

Commit

Permalink
remove unused param, add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Jag96 committed Mar 16, 2021
1 parent ab38d47 commit a673476
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,11 @@ function getSimplifiedIOUReport(reportID, reportData) {
}

/**
* Fetches the updated data for an IOU Report and updates the IOU collection in ONYX
* Fetches the updated data for an IOU Report and updates the IOU collection in Onyx
*
* @param {Number} reportID
* @param {Object[]} reportHistory
*/
function updateIOUReportData(reportID, reportHistory) {
function updateIOUReportData(reportHistory) {
const containsIOUAction = _.any(reportHistory, action => action.actionName === 'IOU');

// If there aren't any IOU actions, we don't need to fetch any additional data
Expand All @@ -553,14 +552,14 @@ function updateIOUReportData(reportID, reportHistory) {
return;
}

// If we have an IOU action, get the IOU reportID
// Since the Chat and the IOU are different reports with different reportIDs, and GetIOUReport only returns the
// IOU's reportID, keep track of the IOU's reportID so we can use it to get the IOUReport data via `GetReportStuff`
let iouReportID = 0;
API.GetIOUReport({
debtorEmail: otherParticipants[0],
}).then((response) => {
iouReportID = response.reportID;

Log.info('[Report] Fetching IOU report data', true, iouReportID);
return API.Get({
returnValueList: 'reportStuff',
reportIDList: iouReportID,
Expand Down Expand Up @@ -608,7 +607,7 @@ function fetchActions(reportID, offset) {
.max()
.value();

updateIOUReportData(reportID, indexedData);
updateIOUReportData(indexedData);

Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, indexedData);
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {maxSequenceNumber});
Expand Down

0 comments on commit a673476

Please sign in to comment.