Fix: fix auto-close when doc update no longer has permissions (#9453)

This commit is contained in:
shamoon
2025-03-21 09:50:04 -07:00
committed by GitHub
parent 5d6cfa7349
commit e60bd3a132
2 changed files with 47 additions and 36 deletions

View File

@@ -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(