Skip to content

Commit 9868552

Browse files
committed
[PER-10107] Disabled detailed preview when preview toggle is off
1 parent d12d5b3 commit 9868552

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

src/app/file-browser/components/file-list-item/file-list-item.component.spec.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
22
import { ElementRef, Pipe, PipeTransform } from '@angular/core';
33
import { of } from 'rxjs';
4-
import { provideRouter } from '@angular/router';
4+
import { ActivatedRoute, provideRouter } from '@angular/router';
55
import { Deferred } from '@root/vendor/deferred';
66

77
import { DataService } from '@shared/services/data/data.service';
@@ -42,6 +42,21 @@ describe('FileListItemComponent', () => {
4242
let fixture: ComponentFixture<FileListItemComponent>;
4343
let editService: EditService;
4444

45+
const activatedRouteMock = {
46+
snapshot: {
47+
data: {},
48+
},
49+
parent: {
50+
snapshot: {
51+
data: {
52+
sharePreviewVO: {
53+
previewToggle: 1,
54+
},
55+
},
56+
},
57+
},
58+
};
59+
4560
const mockEditService = {
4661
moveItems: jasmine.createSpy().and.returnValue(Promise.resolve()),
4762
updateItems: jasmine.createSpy().and.returnValue(Promise.resolve()),
@@ -58,6 +73,7 @@ describe('FileListItemComponent', () => {
5873
providers: [
5974
provideNoopAnimations(),
6075
provideRouter([]),
76+
{ provide: ActivatedRoute, useValue: activatedRouteMock },
6177
{ provide: ElementRef, useValue: { nativeElement: {} } },
6278
{
6379
provide: DataService,

src/app/file-browser/components/file-list-item/file-list-item.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export class FileListItemComponent
205205
public isZip = false;
206206
public date: string = '';
207207
public isUnlistedShare = false;
208+
public canPreview = true;
208209

209210
private folderThumb200: string;
210211
private folderThumb500: string;
@@ -248,6 +249,11 @@ export class FileListItemComponent
248249
const date = new Date(this.item.displayDT);
249250
this.date = getFormattedDate(date);
250251

252+
const sharePreviewVO = this.route.parent.snapshot.data?.sharePreviewVO;
253+
this.canPreview =
254+
!!sharePreviewVO?.previewToggle ||
255+
!!sharePreviewVO?.ShareVO?.previewToggle;
256+
251257
this.isUnlistedShare = await this.shareLinksService.isUnlistedShare();
252258

253259
this.dataService.registerItem(this.item);
@@ -492,13 +498,12 @@ export class FileListItemComponent
492498
}
493499

494500
showUnlistedPreview() {
495-
if (this.isUnlistedShare) {
501+
if (this.canPreview && this.isUnlistedShare) {
496502
//TO DO: make preview for folder --> story PER-10314
497503
if (this.item.isFolder) {
498504
return;
499505
}
500506
this.goToItem();
501-
return;
502507
}
503508
}
504509

0 commit comments

Comments
 (0)