From 6588ca8a6cd5340e7d29eccfc75a86d4dcfa562b Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Thu, 14 Dec 2017 20:20:57 +0000 Subject: [PATCH] fix(aio): do not redirect pages on "next" deployment (#21027) We redirect non-docs pages in the "archive" deployment back to the stable deployment. We should not redirect pages in the "next" deployment. Closes #19505 PR Close #21027 --- aio/src/app/app.component.spec.ts | 8 ++++---- aio/src/app/app.component.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/aio/src/app/app.component.spec.ts b/aio/src/app/app.component.spec.ts index 3565321946..1be070b3f3 100644 --- a/aio/src/app/app.component.spec.ts +++ b/aio/src/app/app.component.spec.ts @@ -723,14 +723,14 @@ describe('AppComponent', () => { expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled(); }); - it('should redirect to `docs` if deployment mode is `next` and not at a docs page', () => { + it('should not redirect if deployment mode is `next`', () => { createTestingModule('', 'next'); initializeTest(); - expect(TestBed.get(LocationService).replace).toHaveBeenCalledWith('docs'); + expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled(); createTestingModule('resources', 'next'); initializeTest(); - expect(TestBed.get(LocationService).replace).toHaveBeenCalledWith('docs'); + expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled(); createTestingModule('guide/aot-compiler', 'next'); initializeTest(); @@ -757,7 +757,7 @@ describe('AppComponent', () => { expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled(); }); - it('should not redirect to `docs` if deployment mode is `stable` and not at a docs page', () => { + it('should not redirect to `docs` if deployment mode is `stable`', () => { createTestingModule('', 'stable'); initializeTest(); expect(TestBed.get(LocationService).replace).not.toHaveBeenCalled(); diff --git a/aio/src/app/app.component.ts b/aio/src/app/app.component.ts index f95b0a2fdf..53c8ac4075 100644 --- a/aio/src/app/app.component.ts +++ b/aio/src/app/app.component.ts @@ -121,9 +121,9 @@ export class AppComponent implements OnInit { this.documentService.currentDocument.first().subscribe(doc => this.updateHostClassesForDoc(doc)); this.locationService.currentPath.subscribe(path => { - // Redirect to docs if we are in not in stable mode and are not hitting a docs page + // Redirect to docs if we are in archive mode and are not hitting a docs page // (i.e. we have arrived at a marketing page) - if (this.deployment.mode !== 'stable' && !/^(docs$|api|guide|tutorial)/.test(path)) { + if (this.deployment.mode === 'archive' && !/^(docs$|api|guide|tutorial)/.test(path)) { this.locationService.replace('docs'); } if (path === this.currentPath) {