Skip to content
Draft
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
4 changes: 3 additions & 1 deletion src/pages/settings/Agents/AddAgentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ function AddAgentPageContent({route, template}: AddAgentPageContentProps) {
if (getIsNarrowLayout()) {
// Reveal the DM under the modal before dismissing so we navigate directly to it in one animation,
// instead of dismissing to the agents list first and navigating to the DM afterward.
Navigation.revealRouteBeforeDismissingModal(ROUTES.REPORT_WITH_ID.getRoute(optimisticReportID));
// backTo points the DM header's back button at the agents list; without it, dismissing the whole
// settings modal stack leaves the list off the back stack, so back would fall through to the LHN.
Navigation.revealRouteBeforeDismissingModal(ROUTES.REPORT_WITH_ID.getRoute(optimisticReportID, undefined, undefined, ROUTES.SETTINGS_AGENTS));
return;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/pages/settings/AddAgentPageTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ describe('AddAgentPage', () => {
expect(mockCreateAgent).toHaveBeenCalledWith('Bot', 'Reject gambling.', OWNER_ACCOUNT_ID, OWNER_LOGIN, 'bot-avatar--blue', undefined, undefined, undefined);
expect(mockClearNewAgentTemplate).toHaveBeenCalledTimes(1);
expect(mockClearNewAgentAvatarDraft).toHaveBeenCalledTimes(1);
expect(mockRevealRouteBeforeDismissingModal).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(OPTIMISTIC_REPORT_ID));
expect(mockRevealRouteBeforeDismissingModal).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(OPTIMISTIC_REPORT_ID, undefined, undefined, ROUTES.SETTINGS_AGENTS));
});

it('forwards policyID from route params to createAgent', () => {
Expand All @@ -328,7 +328,7 @@ describe('AddAgentPage', () => {
mockFormOnSubmit?.({firstName: 'Bot', prompt: 'Reject gambling.'});

expect(mockCreateAgent).toHaveBeenCalledWith('Bot', 'Reject gambling.', OWNER_ACCOUNT_ID, OWNER_LOGIN, 'bot-avatar--blue', undefined, undefined, 'POL_42');
expect(mockRevealRouteBeforeDismissingModal).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(OPTIMISTIC_REPORT_ID));
expect(mockRevealRouteBeforeDismissingModal).toHaveBeenCalledWith(ROUTES.REPORT_WITH_ID.getRoute(OPTIMISTIC_REPORT_ID, undefined, undefined, ROUTES.SETTINGS_AGENTS));
});

it('opens the DM in the RHP on wide layouts instead of the fullscreen report', () => {
Expand Down
Loading