From e60bd3a132ebbdffb99b527ebaf07655a8e61ba2 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Fri, 21 Mar 2025 09:50:04 -0700
Subject: [PATCH] Fix: fix auto-close when doc update no longer has permissions
(#9453)
---
src-ui/messages.xlf | 68 +++++++++----------
.../document-detail.component.ts | 15 +++-
2 files changed, 47 insertions(+), 36 deletions(-)
diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf
index 1977c4203..040419c57 100644
--- a/src-ui/messages.xlf
+++ b/src-ui/messages.xlf
@@ -2537,19 +2537,19 @@
src/app/components/document-detail/document-detail.component.ts
- 958
+ 968
src/app/components/document-detail/document-detail.component.ts
- 1318
+ 1328
src/app/components/document-detail/document-detail.component.ts
- 1357
+ 1367
src/app/components/document-detail/document-detail.component.ts
- 1398
+ 1408
src/app/components/document-list/bulk-editor/bulk-editor.component.ts
@@ -3157,7 +3157,7 @@
src/app/components/document-detail/document-detail.component.ts
- 911
+ 921
src/app/components/document-list/bulk-editor/bulk-editor.component.ts
@@ -3406,7 +3406,7 @@
src/app/components/document-detail/document-detail.component.ts
- 1375
+ 1385
src/app/guards/dirty-saved-view.guard.ts
@@ -6908,35 +6908,35 @@
src/app/components/document-detail/document-detail.component.ts
- 829
+ 839
Error saving document ""
src/app/components/document-detail/document-detail.component.ts
- 835
+ 845
Error saving document
src/app/components/document-detail/document-detail.component.ts
- 880
+ 890
Do you really want to move the document "" to the trash?
src/app/components/document-detail/document-detail.component.ts
- 912
+ 922
Documents can be restored prior to permanent deletion.
src/app/components/document-detail/document-detail.component.ts
- 913
+ 923
src/app/components/document-list/bulk-editor/bulk-editor.component.ts
@@ -6947,7 +6947,7 @@
Move to trash
src/app/components/document-detail/document-detail.component.ts
- 915
+ 925
src/app/components/document-list/bulk-editor/bulk-editor.component.ts
@@ -6958,14 +6958,14 @@
Error deleting document
src/app/components/document-detail/document-detail.component.ts
- 934
+ 944
Reprocess confirm
src/app/components/document-detail/document-detail.component.ts
- 954
+ 964
src/app/components/document-list/bulk-editor/bulk-editor.component.ts
@@ -6976,77 +6976,77 @@
This operation will permanently recreate the archive file for this document.
src/app/components/document-detail/document-detail.component.ts
- 955
+ 965
The archive file will be re-generated with the current settings.
src/app/components/document-detail/document-detail.component.ts
- 956
+ 966
Reprocess operation for "" will begin in the background. Close and re-open or reload this document after the operation has completed to see new content.
src/app/components/document-detail/document-detail.component.ts
- 966
+ 976
Error executing operation
src/app/components/document-detail/document-detail.component.ts
- 977
+ 987
Error downloading document
src/app/components/document-detail/document-detail.component.ts
- 1024
+ 1034
Page Fit
src/app/components/document-detail/document-detail.component.ts
- 1103
+ 1113
Split confirm
src/app/components/document-detail/document-detail.component.ts
- 1316
+ 1326
This operation will split the selected document(s) into new documents.
src/app/components/document-detail/document-detail.component.ts
- 1317
+ 1327
Split operation for "" will begin in the background.
src/app/components/document-detail/document-detail.component.ts
- 1333
+ 1343
Error executing split operation
src/app/components/document-detail/document-detail.component.ts
- 1342
+ 1352
Rotate confirm
src/app/components/document-detail/document-detail.component.ts
- 1355
+ 1365
src/app/components/document-list/bulk-editor/bulk-editor.component.ts
@@ -7057,60 +7057,60 @@
This operation will permanently rotate the original version of the current document.
src/app/components/document-detail/document-detail.component.ts
- 1356
+ 1366
Rotation of "" will begin in the background. Close and re-open the document after the operation has completed to see the changes.
src/app/components/document-detail/document-detail.component.ts
- 1372
+ 1382
Error executing rotate operation
src/app/components/document-detail/document-detail.component.ts
- 1384
+ 1394
Delete pages confirm
src/app/components/document-detail/document-detail.component.ts
- 1396
+ 1406
This operation will permanently delete the selected pages from the original document.
src/app/components/document-detail/document-detail.component.ts
- 1397
+ 1407
Delete pages operation for "" will begin in the background. Close and re-open or reload this document after the operation has completed to see the changes.
src/app/components/document-detail/document-detail.component.ts
- 1412
+ 1422
Error executing delete pages operation
src/app/components/document-detail/document-detail.component.ts
- 1421
+ 1431
An error occurred loading tiff:
src/app/components/document-detail/document-detail.component.ts
- 1481
+ 1491
src/app/components/document-detail/document-detail.component.ts
- 1485
+ 1495
diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts
index 27a74cfcd..ba3b76bc3 100644
--- a/src-ui/src/app/components/document-detail/document-detail.component.ts
+++ b/src-ui/src/app/components/document-detail/document-detail.component.ts
@@ -824,11 +824,22 @@ export class DocumentDetailComponent
},
error: (error) => {
this.networkActive = false
- if (!this.userCanEdit) {
+ const canEdit =
+ this.permissionsService.currentUserCan(
+ PermissionAction.Change,
+ PermissionType.Document
+ ) &&
+ this.permissionsService.currentUserHasObjectPermissions(
+ PermissionAction.Change,
+ this.document
+ )
+ if (!canEdit) {
+ // document was 'given away'
+ this.openDocumentService.setDirty(this.document, false)
this.toastService.showInfo(
$localize`Document "${this.document.title}" saved successfully.`
)
- close && this.close()
+ this.close()
} else {
this.error = error.error
this.toastService.showError(