Skip to content

Commit ccdf84f

Browse files
committed
[ACS-10165] remove flag
1 parent d68efaf commit ccdf84f

File tree

2 files changed

+6
-37
lines changed

2 files changed

+6
-37
lines changed

projects/aca-content/src/lib/components/library-list/library-list.component.spec.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import { ComponentFixture, TestBed } from '@angular/core/testing';
2626
import { Router } from '@angular/router';
27-
import { AppConfigService, UnitTestingUtils, UserPreferencesService } from '@alfresco/adf-core';
27+
import { UnitTestingUtils, UserPreferencesService } from '@alfresco/adf-core';
2828
import { DocumentListComponent, SitesService } from '@alfresco/adf-content-services';
2929
import { LibraryListComponent } from './library-list.component';
3030
import { AppTestingModule } from '../../testing/app-testing.module';
@@ -46,8 +46,6 @@ describe('LibraryListComponent', () => {
4646
let appHookService: AppHookService;
4747
let getSitesSpy: jasmine.Spy<(options?: any) => Observable<SitePaging>>;
4848
let unitTestingUtils: UnitTestingUtils;
49-
let appConfig: AppConfigService;
50-
let getLegalHoldsEnabledSpy: jasmine.Spy<(key: string, defaultValue?: string | boolean) => string | boolean>;
5149

5250
const paging: SitePaging = {
5351
list: {
@@ -59,8 +57,6 @@ describe('LibraryListComponent', () => {
5957
}
6058
};
6159

62-
const whereOpt = `(preset='site-dashboard')`;
63-
6460
beforeEach(() => {
6561
TestBed.configureTestingModule({
6662
imports: [AppTestingModule, LibraryListComponent, MatSnackBarModule],
@@ -74,13 +70,10 @@ describe('LibraryListComponent', () => {
7470
sitesService = TestBed.inject(SitesService);
7571
userPreference = TestBed.inject(UserPreferencesService);
7672
appHookService = TestBed.inject(AppHookService);
77-
appConfig = TestBed.inject(AppConfigService);
7873
router = TestBed.inject(Router);
7974

8075
getSitesSpy = spyOn(sitesService, 'getSites');
8176
getSitesSpy.and.returnValue(of(paging));
82-
getLegalHoldsEnabledSpy = spyOn(appConfig, 'get');
83-
getLegalHoldsEnabledSpy.and.returnValue(false);
8477
fixture.detectChanges();
8578
});
8679

@@ -93,7 +86,7 @@ describe('LibraryListComponent', () => {
9386
it('should get data with user preference pagination size', () => {
9487
userPreference.paginationSize = 1;
9588
component.ngOnInit();
96-
expect(sitesService.getSites).toHaveBeenCalledWith({ maxItems: 1, where: whereOpt });
89+
expect(sitesService.getSites).toHaveBeenCalledWith({ maxItems: 1 });
9790
});
9891

9992
it('should set data on error', () => {
@@ -121,19 +114,6 @@ describe('LibraryListComponent', () => {
121114
});
122115
});
123116

124-
describe('Legal Holds flag', () => {
125-
it('should call getSites with where option when legal holds disabled', () => {
126-
component.ngOnInit();
127-
expect(sitesService.getSites).toHaveBeenCalledWith(jasmine.objectContaining({ where: whereOpt }));
128-
});
129-
130-
it('should not call getSites with where option when legal holds enabled', () => {
131-
getLegalHoldsEnabledSpy.and.returnValue(true);
132-
component.ngOnInit();
133-
expect(sitesService.getSites).toHaveBeenCalledWith(jasmine.objectContaining({ where: undefined }));
134-
});
135-
});
136-
137117
describe('Node navigation', () => {
138118
it('should not navigate when node is null or missing guid', () => {
139119
spyOn(router, 'navigate').and.stub();
@@ -198,12 +178,12 @@ describe('LibraryListComponent', () => {
198178

199179
it('should get list with pagination data onChange event', () => {
200180
component.getList(pagination);
201-
expect(sitesService.getSites).toHaveBeenCalledWith({ ...pagination, where: whereOpt });
181+
expect(sitesService.getSites).toHaveBeenCalledWith(pagination);
202182
});
203183

204184
it('should get list with pagination data onChangePageSize event', () => {
205185
component.onChangePageSize(pagination);
206-
expect(sitesService.getSites).toHaveBeenCalledWith({ ...pagination, where: whereOpt });
186+
expect(sitesService.getSites).toHaveBeenCalledWith(pagination);
207187
});
208188

209189
it('should set preference page size onChangePageSize event', () => {

projects/aca-content/src/lib/components/library-list/library-list.component.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
} from '@alfresco/aca-shared';
3535
import { NavigateLibraryAction } from '@alfresco/aca-shared/store';
3636
import {
37-
AppConfigService,
3837
CustomEmptyContentTemplateDirective,
3938
DataColumnComponent,
4039
DataColumnListComponent,
@@ -80,24 +79,18 @@ export class LibraryListComponent extends PageComponent implements OnInit {
8079
list: SitePaging;
8180
columns: DocumentListPresetRef[] = [];
8281

83-
private legalHoldsEnabled = false;
84-
8582
constructor(
8683
private readonly appHookService: AppHookService,
8784
private readonly preferences: UserPreferencesService,
8885
private readonly changeDetectorRef: ChangeDetectorRef,
89-
private readonly sitesService: SitesService,
90-
private readonly appConfig: AppConfigService
86+
private readonly sitesService: SitesService
9187
) {
9288
super();
9389
}
9490

9591
ngOnInit() {
9692
super.ngOnInit();
9793

98-
const legalHoldFlag = this.appConfig.get<boolean | string>('plugins.legalHoldEnabled', false);
99-
this.legalHoldsEnabled = legalHoldFlag === true || legalHoldFlag === 'true';
100-
10194
this.getList({ maxItems: this.preferences.paginationSize });
10295

10396
merge(this.appHookService.libraryDeleted, this.appHookService.libraryUpdated, this.appHookService.libraryJoined, this.appHookService.libraryLeft)
@@ -123,11 +116,7 @@ export class LibraryListComponent extends PageComponent implements OnInit {
123116

124117
getList(pagination: Pagination) {
125118
this.isLoading = true;
126-
let where: string | undefined;
127-
if (!this.legalHoldsEnabled) {
128-
where = `(preset='site-dashboard')`;
129-
}
130-
this.sitesService.getSites({ ...pagination, where: where }).subscribe({
119+
this.sitesService.getSites(pagination).subscribe({
131120
next: (libraryList: SitePaging) => {
132121
this.list = libraryList;
133122
this.pagination = libraryList.list.pagination;

0 commit comments

Comments
 (0)