Skip to content

Commit a9b8182

Browse files
committed
Hiding these checks behind the feature flag
1 parent e2310d9 commit a9b8182

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/editor.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4903,6 +4903,7 @@ class TestEnvironment {
49034903
when(mockedDraftGenerationService.draftExists(anything(), anything(), anything())).thenReturn(of(true));
49044904
when(mockedPermissionsService.isUserOnProject(anything())).thenResolve(true);
49054905
when(mockedFeatureFlagService.newDraftHistory).thenReturn(createTestFeatureFlag(false));
4906+
when(mockedFeatureFlagService.usfmFormat).thenReturn(createTestFeatureFlag(true));
49064907
when(mockedLynxWorkspaceService.rawInsightSource$).thenReturn(of([]));
49074908

49084909
this.realtimeService = TestBed.inject(TestRealtimeService);

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/editor.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ import { browserLinks, getLinkHTML, isBlink, issuesEmailTemplate, objectId } fro
100100
import { XFValidators } from 'xforge-common/xfvalidators';
101101
import { environment } from '../../../environments/environment';
102102
import { isString } from '../../../type-utils';
103+
import { FeatureFlagService } from '../../../xforge-common/feature-flags/feature-flag.service';
103104
import { defaultNoteThreadIcon, NoteThreadDoc, NoteThreadIcon } from '../../core/models/note-thread-doc';
104105
import { SFProjectDoc } from '../../core/models/sf-project-doc';
105106
import { SFProjectProfileDoc } from '../../core/models/sf-project-profile-doc';
@@ -317,7 +318,8 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy,
317318
private readonly breakpointObserver: BreakpointObserver,
318319
private readonly mediaBreakpointService: MediaBreakpointService,
319320
private readonly permissionsService: PermissionsService,
320-
readonly editorInsightState: LynxInsightStateService
321+
readonly editorInsightState: LynxInsightStateService,
322+
private readonly featureFlagService: FeatureFlagService
321323
) {
322324
super(noticeService);
323325
const wordTokenizer = new LatinWordTokenizer();
@@ -1489,6 +1491,7 @@ export class EditorComponent extends DataLoadingComponent implements OnDestroy,
14891491
this.userService.currentUserId
14901492
);
14911493
const hasSetDraftFormatting =
1494+
!this.featureFlagService.usfmFormat.enabled ||
14921495
this.activatedProject.projectDoc?.data?.translateConfig.draftConfig.usfmConfig != null;
14931496
if (((hasDraft && !draftApplied) || urlDraftActive) && canViewDrafts && hasSetDraftFormatting) {
14941497
// URL may indicate to select the 'draft' tab (such as when coming from generate draft page)

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/tabs/editor-tab-menu.service.spec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import { TestOnlineStatusService } from 'xforge-common/test-online-status.servic
1212
import { TestRealtimeModule } from 'xforge-common/test-realtime.module';
1313
import { configureTestingModule, TestTranslocoModule } from 'xforge-common/test-utils';
1414
import { UserService } from 'xforge-common/user.service';
15+
import {
16+
createTestFeatureFlag,
17+
FeatureFlagService
18+
} from '../../../../xforge-common/feature-flags/feature-flag.service';
1519
import { SFProjectProfileDoc } from '../../../core/models/sf-project-profile-doc';
1620
import { SF_TYPE_REGISTRY } from '../../../core/models/sf-type-registry';
1721
import { PermissionsService } from '../../../core/permissions.service';
@@ -24,6 +28,7 @@ const activatedProjectMock = mock(ActivatedProjectService);
2428
const tabStateMock: TabStateService<any, any> = mock(TabStateService);
2529
const mockUserService = mock(UserService);
2630
const mockPermissionsService = mock(PermissionsService);
31+
const mockFeatureFlagService = mock(FeatureFlagService);
2732

2833
describe('EditorTabMenuService', () => {
2934
configureTestingModule(() => ({
@@ -34,7 +39,8 @@ describe('EditorTabMenuService', () => {
3439
{ provide: TabStateService, useMock: tabStateMock },
3540
{ provide: UserService, useMock: mockUserService },
3641
{ provide: PermissionsService, useMock: mockPermissionsService },
37-
{ provide: OnlineStatusService, useClass: TestOnlineStatusService }
42+
{ provide: OnlineStatusService, useClass: TestOnlineStatusService },
43+
{ provide: FeatureFlagService, useMock: mockFeatureFlagService }
3844
]
3945
}));
4046

@@ -320,6 +326,7 @@ class TestEnvironment {
320326
when(activatedProjectMock.projectDoc).thenReturn(projectDoc as any);
321327
when(mockUserService.currentUserId).thenReturn('user01');
322328
when(mockPermissionsService.canAccessDrafts(anything(), anything())).thenReturn(true);
329+
when(mockFeatureFlagService.usfmFormat).thenReturn(createTestFeatureFlag(true));
323330
service = TestBed.inject(EditorTabMenuService);
324331
}
325332

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/tabs/editor-tab-menu.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { I18nService } from 'xforge-common/i18n.service';
1212
import { OnlineStatusService } from 'xforge-common/online-status.service';
1313
import { UserService } from 'xforge-common/user.service';
1414
import { filterNullish, quietTakeUntilDestroyed } from 'xforge-common/util/rxjs-util';
15+
import { FeatureFlagService } from '../../../../xforge-common/feature-flags/feature-flag.service';
1516
import { SFProjectProfileDoc } from '../../../core/models/sf-project-profile-doc';
1617
import { ParatextService } from '../../../core/paratext.service';
1718
import { PermissionsService } from '../../../core/permissions.service';
@@ -29,7 +30,8 @@ export class EditorTabMenuService implements TabMenuService<EditorTabGroupType>
2930
private readonly onlineStatus: OnlineStatusService,
3031
private readonly tabState: TabStateService<EditorTabGroupType, EditorTabInfo>,
3132
private readonly permissionsService: PermissionsService,
32-
private readonly i18n: I18nService
33+
private readonly i18n: I18nService,
34+
private readonly featureFlagService: FeatureFlagService
3335
) {}
3436

3537
getMenuItems(): Observable<TabMenuItem[]> {
@@ -47,12 +49,15 @@ export class EditorTabMenuService implements TabMenuService<EditorTabGroupType>
4749
return combineLatest([of(projectDoc), of(isOnline), this.tabState.tabs$]);
4850
}),
4951
switchMap(([projectDoc, isOnline, existingTabs]) => {
52+
const hasSetDraftFormatting =
53+
!this.featureFlagService.usfmFormat.enabled ||
54+
this.activatedProject.projectDoc?.data?.translateConfig.draftConfig.usfmConfig != null;
5055
const showDraft =
5156
isOnline &&
5257
projectDoc.data != null &&
5358
SFProjectService.hasDraft(projectDoc.data) &&
5459
this.permissionsService.canAccessDrafts(projectDoc, this.userService.currentUserId) &&
55-
this.activatedProject.projectDoc?.data?.translateConfig.draftConfig.usfmConfig != null;
60+
hasSetDraftFormatting;
5661
const items: Observable<TabMenuItem>[] = [];
5762

5863
for (const tabType of editorTabTypes) {

0 commit comments

Comments
 (0)