From adbab25bb13317a3cdfef17bb375bc522059d152 Mon Sep 17 00:00:00 2001 From: Andreas Pfohl Date: Mon, 30 Jan 2023 11:02:45 +0100 Subject: [PATCH] [#45945] File linking modal bahaves bad on group folders https://community.openproject.org/work_packages/45945 --- .../file-picker-modal/file-picker-modal.component.ts | 1 + .../location-picker-modal.component.ts | 5 +++++ .../storage-file-list-item/storage-file-list-item.html | 2 +- .../storage-file-list-item/storage-file-list-item.ts | 9 +-------- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts index 7e5af3ee05..c056680980 100644 --- a/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts +++ b/frontend/src/app/shared/components/storages/file-picker-modal/file-picker-modal.component.ts @@ -149,6 +149,7 @@ export class FilePickerModalComponent extends FilePickerBaseModalComponent { this.isAlreadyLinked(file), index === 0, this.enterDirectoryCallback(file), + false, this.tooltip(file), { selected: this.selection.has(file.id as string), diff --git a/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts b/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts index 68b55b617e..66b17ca098 100644 --- a/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts +++ b/frontend/src/app/shared/components/storages/location-picker-modal/location-picker-modal.component.ts @@ -113,11 +113,16 @@ export class LocationPickerModalComponent extends FilePickerBaseModalComponent { !isDirectory(file), index === 0, this.enterDirectoryCallback(file), + this.isConstrained(file), this.tooltip(file), undefined, ); } + private isConstrained(file:IStorageFile):boolean { + return !file.permissions.some((permission) => permission === 'writeable'); + } + private tooltip(file:IStorageFile):string|undefined { if (isDirectory(file)) { return file.permissions.some((permission) => permission === 'writeable') diff --git a/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.html b/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.html index d017f9858d..311e4d1a31 100644 --- a/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.html +++ b/frontend/src/app/shared/components/storages/storage-file-list-item/storage-file-list-item.html @@ -13,7 +13,7 @@ data-qa-selector="op-files-picker-modal--list-item" [ngClass]="{ 'spot-list--item-action_disabled': content.disabled, - 'op-file-list--item-action_view-not-allowed': !content.isWriteable + 'op-file-list--item-action_view-not-allowed': content.isConstrained }" > permission === 'writeable'); - } - - get isReadable():boolean { - return this.storageFile.permissions.some((permission) => permission === 'readable'); - } - constructor( private readonly timezoneService:TimezoneService, private readonly storageFile:IStorageFile, public readonly disabled:boolean, public readonly isFirst:boolean, public readonly enterDirectory:() => void, + public readonly isConstrained:boolean, public readonly tooltip?:string, public readonly checkbox?:StorageFileListItemCheckbox, ) {}