Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 10 additions & 2 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,8 @@ function fetchChatReportsByIDs(chatList, shouldRedirectIfInacessible = false) {
})
.catch((err) => {
if (err.message === CONST.REPORT.ERROR.INACCESSIBLE_REPORT) {
Growl.error(translateLocal('notFound.chatYouLookingForCannotBeFound'));
// eslint-disable-next-line no-use-before-define
navigateToConciergeChat();
handleInaccessibleReport();
}
});
}
Expand Down Expand Up @@ -1365,6 +1364,14 @@ function navigateToConciergeChat() {
Navigation.closeDrawer();
}

/**
* Handle the navigation when report is inaccessible
*/
function handleInaccessibleReport() {
Growl.error(translateLocal('notFound.chatYouLookingForCannotBeFound'));
navigateToConciergeChat();
}

export {
fetchAllReports,
fetchActions,
Expand All @@ -1389,4 +1396,5 @@ export {
getSimplifiedIOUReport,
syncChatAndIOUReports,
navigateToConciergeChat,
handleInaccessibleReport,
};
7 changes: 6 additions & 1 deletion src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from 'react';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
import _ from 'underscore';
import styles from '../../styles/styles';
import ReportView from './report/ReportView';
import ScreenWrapper from '../../components/ScreenWrapper';
import HeaderView from './HeaderView';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
import FullScreenLoadingIndicator from '../../components/FullscreenLoadingIndicator';
import {updateCurrentlyViewedReportID} from '../../libs/actions/Report';
import {handleInaccessibleReport, updateCurrentlyViewedReportID} from '../../libs/actions/Report';
import ONYXKEYS from '../../ONYXKEYS';

const propTypes = {
Expand Down Expand Up @@ -89,6 +90,10 @@ class ReportScreen extends React.Component {
*/
storeCurrentlyViewedReport() {
const reportID = this.getReportID();
if (_.isNaN(reportID)) {
handleInaccessibleReport();
return;
}
updateCurrentlyViewedReportID(reportID);
}

Expand Down