Skip to content

Commit 0c6c942

Browse files
authored
Merge pull request #4534 from parasharrajat/ioudetails
Handle undefined IOU Report on IOUdetails page
2 parents bac9675 + 109a2c8 commit 0c6c942

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

src/languages/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ export default {
337337
notFound: {
338338
chatYouLookingForCannotBeFound: 'The chat you are looking for cannot be found.',
339339
getMeOutOfHere: 'Get me out of here',
340+
iouReportNotFound: 'The payment details you are looking for cannot be found.',
340341
},
341342
setPasswordPage: {
342343
enterPassword: 'Enter a password',

src/languages/es.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,9 @@ export default {
335335
createGroup: 'Crear Grupo',
336336
},
337337
notFound: {
338-
chatYouLookingForCannotBeFound: 'No se pudo encontrar el chat que estabas buscando.',
338+
chatYouLookingForCannotBeFound: 'El chat que estás buscando no se ha podido encontrar.',
339339
getMeOutOfHere: 'Sácame de aquí',
340+
iouReportNotFound: 'Los detalles del pago que estás buscando no se han podido encontrar.',
340341
},
341342
setPasswordPage: {
342343
enterPassword: 'Escribe una contraseña',

src/libs/actions/Report.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,17 @@ function removeOptimisticActions(reportID) {
461461
*
462462
* @param {Number} iouReportID - ID of the report we are fetching
463463
* @param {Number} chatReportID - associated chatReportID, set as an iouReport field
464+
* @param {Boolean} [shouldRedirectIfEmpty=false] - Whether to redirect to Active Report Screen if IOUReport is empty
464465
* @returns {Promise}
465466
*/
466-
function fetchIOUReportByID(iouReportID, chatReportID) {
467+
function fetchIOUReportByID(iouReportID, chatReportID, shouldRedirectIfEmpty = false) {
467468
return fetchIOUReport(iouReportID, chatReportID)
468469
.then((iouReportObject) => {
470+
if (!iouReportObject && shouldRedirectIfEmpty) {
471+
Growl.error(translateLocal('notFound.iouReportNotFound'));
472+
Navigation.navigate(ROUTES.REPORT);
473+
return;
474+
}
469475
setLocalIOUReportData(iouReportObject);
470476
return iouReportObject;
471477
});

src/pages/iou/IOUDetailsModal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class IOUDetailsModal extends Component {
107107

108108
componentDidMount() {
109109
this.isComponentMounted = true;
110-
fetchIOUReportByID(this.props.route.params.iouReportID, this.props.route.params.chatReportID);
110+
fetchIOUReportByID(this.props.route.params.iouReportID, this.props.route.params.chatReportID, true);
111111
this.addVenmoPaymentOptionIfAvailable();
112112
this.addExpensifyPaymentOptionIfAvailable();
113113
}

0 commit comments

Comments
 (0)