Skip to content

Commit e7104be

Browse files
committed
Create a stub folder when previewing an unlisted share record
When previewing a record as an unlisted share, the folder cannot be retrieved because the logged in user does not have rights to view it. This is why we need to create a mock folder that will be saved in the data service and be used accross the components from the share flow. Issue: PER-10371 Unlisted share record preview broken
1 parent 3f01b5e commit e7104be

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/app/share-preview/components/share-preview/share-preview.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ describe('SharePreviewComponent', () => {
9494
mockRoute.snapshot.data = {
9595
sharePreviewVO: {
9696
ArchiveVO: {},
97+
FolderVO: {},
9798
AccountVO: { fullName: 'Sharer Name' },
9899
ShareVO: { accessRole: 'viewer', status: 'pending' },
99100
status: 'pending',

src/app/share-preview/components/share-preview/share-preview.component.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,15 @@ export class SharePreviewComponent implements OnInit, OnDestroy {
197197
this.isUnlistedShare = await this.shareLinksService.isUnlistedShare();
198198

199199
if (this.isUnlistedShare) {
200-
this.ephemeralFolder = await this.filesystemService.getFolder(
201-
this.route.snapshot.data.sharePreviewVO.FolderVO,
202-
);
200+
if (this.route.snapshot.data.sharePreviewVO?.FolderVO) {
201+
this.ephemeralFolder = await this.filesystemService.getFolder(
202+
this.route.snapshot.data.sharePreviewVO.FolderVO,
203+
);
204+
} else {
205+
this.ephemeralFolder = this.route.snapshot.data.currentFolder;
206+
this.ephemeralFolder.folderId =
207+
this.route.snapshot.data.sharePreviewVO?.RecordVO?.parentFolderId;
208+
}
203209
this.dataService.ephemeralFolder = this.ephemeralFolder;
204210
this.dataService.pushBreadcrumbFolder(this.ephemeralFolder);
205211
}

0 commit comments

Comments
 (0)