Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
fix(frontend:files): align shared lock actions with backend ownership rules
johaven447f98c16ed8
diff --git a/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.html b/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.htmlindex 72732eba..17fc3ff8 100755--- a/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.html+++ b/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.html@@ -23,14 +23,12 @@</div><div class="modal-footer"><button (click)="layout.closeDialog()" class="btn btn-secondary" data-dismiss="modal" type="button" l10nTranslate>- {{ hasExclusiveLock ? 'Cancel' : 'Close' }}+ {{ hasAction ? 'Cancel' : 'Close' }}</button>- @if (hasExclusiveLock) {- @if (isLockOwner || isFileOwner) {- <button (click)="onUnlock()" [disabled]="submitted" class="btn btn-primary" type="button" l10nTranslate>Unlock</button>- }- @if (!isLockOwner) {- <button (click)="onSendUnLockRequest()" [disabled]="submitted" class="btn btn-success" type="button" l10nTranslate>Send an unlock request</button>- }+ @if (canUnlock) {+ <button (click)="onUnlock()" [disabled]="submitted" class="btn btn-primary" type="button" l10nTranslate>Unlock</button>+ }+ @if (canRequestUnlock) {+ <button (click)="onSendUnLockRequest()" [disabled]="submitted" class="btn btn-success" type="button" l10nTranslate>Send an unlock request</button>}</div>diff --git a/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.tsindex 597986d9..d8c1da2e 100644--- a/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.ts+++ b/frontend/src/app/applications/files/components/dialogs/files-lock-dialog.component.ts@@ -38,12 +38,26 @@ export class FilesLockDialogComponent implements OnInit {this.userAvatarUrl = userAvatarUrl(this.file.lock.owner.login)}+ protected get canUnlock(): boolean {+ return this.isLockOwner || this.isFileOwner+ }++ protected get canRequestUnlock(): boolean {+ return this.hasExclusiveLock && !this.isLockOwner+ }++ protected get hasAction(): boolean {+ return this.canUnlock || this.canRequestUnlock+ }+@HostListener('document:keyup.enter')async onEnter() {- if (this.isLockOwner || this.isFileOwner) {+ if (this.canUnlock) {await this.onUnlock()- } else {+ } else if (this.canRequestUnlock) {this.onSendUnLockRequest()+ } else {+ this.layout.closeDialog()}}