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

Fix incorrect navigation when update Report welcome message after visit by direct link #25543

Merged
merged 14 commits into from
Oct 6, 2023
Merged
4 changes: 2 additions & 2 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ function updateNotificationPreference(reportID, previousValue, newValue, navigat
function updateWelcomeMessage(reportID, previousValue, newValue) {
// No change needed, navigate back
if (previousValue === newValue) {
Navigation.goBack(ROUTES.HOME);
Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(reportID));
return;
}

Expand All @@ -1354,7 +1354,7 @@ function updateWelcomeMessage(reportID, previousValue, newValue) {
},
];
API.write('UpdateWelcomeMessage', {reportID, welcomeMessage: parsedWelcomeMessage}, {optimisticData, failureData});
Navigation.goBack(ROUTES.HOME);
Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(reportID));
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/pages/ReimbursementAccount/EnableStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const propTypes = {
/* The workspace name */
policyName: PropTypes.string,

/** Method to trigger when pressing back button of the header */
onBackButtonPress: PropTypes.func.isRequired,

...withLocalizePropTypes,
};

Expand Down Expand Up @@ -63,6 +66,7 @@ function EnableStep(props) {
subtitle={props.policyName}
shouldShowGetAssistanceButton
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT}
onBackButtonPress={props.onBackButtonPress}
/>
<ScrollView style={[styles.flex1]}>
<Section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ class ReimbursementAccountPage extends React.Component {
<EnableStep
reimbursementAccount={this.props.reimbursementAccount}
policyName={policyName}
onBackButtonPress={this.goBack}
/>
);
}
Expand Down
7 changes: 6 additions & 1 deletion src/pages/ReportWelcomeMessagePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import FullPageNotFoundView from '../components/BlockingViews/FullPageNotFoundVi
import Form from '../components/Form';
import * as PolicyUtils from '../libs/PolicyUtils';
import {policyPropTypes, policyDefaultProps} from './workspace/withPolicy';
import ROUTES from '../ROUTES';
import Navigation from '../libs/Navigation/Navigation';
import updateMultilineInputRange from '../libs/UpdateMultilineInputRange';

const propTypes = {
Expand Down Expand Up @@ -75,7 +77,10 @@ function ReportWelcomeMessagePage(props) {
return (
<ScreenWrapper testID={ReportWelcomeMessagePage.displayName}>
<FullPageNotFoundView shouldShow={!PolicyUtils.isPolicyAdmin(props.policy)}>
<HeaderWithBackButton title={props.translate('welcomeMessagePage.welcomeMessage')} />
<HeaderWithBackButton
title={props.translate('welcomeMessagePage.welcomeMessage')}
onBackButtonPress={() => Navigation.goBack(ROUTES.REPORT_SETTINGS.getRoute(props.report.reportID))}
/>
<Form
style={[styles.flexGrow1, styles.ph5]}
formID={ONYXKEYS.FORMS.WELCOME_MESSAGE_FORM}
Expand Down
1 change: 1 addition & 0 deletions src/pages/workspace/WorkspaceInviteMessagePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class WorkspaceInviteMessagePage extends React.Component {
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_MEMBERS}
shouldShowBackButton
onCloseButtonPress={() => Navigation.dismissModal()}
onBackButtonPress={() => Navigation.goBack(ROUTES.WORKSPACE_INVITE.getRoute(this.props.route.params.policyID))}
/>
<Form
style={[styles.flexGrow1, styles.ph5]}
Expand Down
Loading