Skip to content

Commit 3582107

Browse files
committed
Removed deactivate guard from formatting page
This was in response to review comments. It prevents the confirmation from being shown twice (I think), but it also removes the guard from Back altogether. So now we're just trying to remind them about unsaved changes on Cancel.
1 parent a1a02ce commit 3582107

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('DraftUsfmFormatComponent', () => {
130130
const env = new TestEnvironment({ quotationAnalysis: QuotationAnalysis.Successful });
131131
expect(env.component.paragraphFormat.value).toBe(ParagraphBreakFormat.BestGuess);
132132
expect(env.component.quoteFormat.value).toBe(QuoteFormat.Denormalized);
133-
expect(await env.component.confirmLeave()).toBe(true);
133+
expect(await env.component['confirmLeave']()).toBe(true);
134134
expect(env.quoteFormatWarning).toBeNull();
135135
}));
136136

@@ -158,7 +158,7 @@ describe('DraftUsfmFormatComponent', () => {
158158
tick();
159159
env.fixture.detectChanges();
160160
// user will be prompted that there are unsaved changes
161-
expect(await env.component.confirmLeave()).toBe(true);
161+
expect(await env.component['confirmLeave']()).toBe(true);
162162
verify(mockedProjectService.onlineSetUsfmConfig(env.projectId, anything())).never();
163163
verify(mockedLocation.back()).once();
164164
}));

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-usfm-format/draft-usfm-format.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import { TextDocId } from '../../../core/models/text-doc';
3131
import { SFProjectService } from '../../../core/sf-project.service';
3232
import { QuotationAnalysis } from '../../../machine-api/quotation-denormalization';
3333
import { ServalAdministrationService } from '../../../serval-administration/serval-administration.service';
34-
import { ConfirmOnLeave } from '../../../shared/project-router.guard';
3534
import { SharedModule } from '../../../shared/shared.module';
3635
import { TextComponent } from '../../../shared/text/text.component';
3736
import { DraftGenerationService } from '../draft-generation.service';
@@ -57,7 +56,7 @@ import { DraftHandlingService } from '../draft-handling.service';
5756
templateUrl: './draft-usfm-format.component.html',
5857
styleUrl: './draft-usfm-format.component.scss'
5958
})
60-
export class DraftUsfmFormatComponent extends DataLoadingComponent implements AfterViewInit, ConfirmOnLeave {
59+
export class DraftUsfmFormatComponent extends DataLoadingComponent implements AfterViewInit {
6160
@ViewChild(TextComponent) draftText!: TextComponent;
6261
bookNum: number = 1;
6362
booksWithDrafts: number[] = [];
@@ -229,7 +228,7 @@ export class DraftUsfmFormatComponent extends DataLoadingComponent implements Af
229228
}
230229
}
231230

232-
async confirmLeave(): Promise<boolean> {
231+
private async confirmLeave(): Promise<boolean> {
233232
if (
234233
this.lastSavedState?.paragraphFormat === this.currentFormat?.paragraphFormat &&
235234
this.lastSavedState?.quoteFormat === this.currentFormat?.quoteFormat

src/SIL.XForge.Scripture/ClientApp/src/app/translate/translate-routing.module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ const routes: Routes = [
2929
{
3030
path: 'projects/:projectId/draft-generation/format',
3131
component: DraftUsfmFormatComponent,
32-
canActivate: [NmtDraftAuthGuard],
33-
canDeactivate: [DraftNavigationAuthGuard]
32+
canActivate: [NmtDraftAuthGuard]
3433
},
3534
{
3635
path: 'projects/:projectId/draft-generation/format/:bookId',

0 commit comments

Comments
 (0)