Revert "Fix: fix auto-close after giving a document away"

This reverts commit d0ec06d684fd1c8a656bd6d173a7d23c33bb5b0c.
This commit is contained in:
shamoon
2025-03-21 09:37:25 -07:00
parent c27e3c75cd
commit 5b49832609
4 changed files with 6 additions and 49 deletions

View File

@@ -1,9 +1,5 @@
import { DatePipe } from '@angular/common'
import {
HttpErrorResponse,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http'
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
import {
HttpTestingController,
provideHttpClientTesting,
@@ -507,7 +503,7 @@ describe('DocumentDetailComponent', () => {
const updateSpy = jest.spyOn(documentService, 'update')
const toastSpy = jest.spyOn(toastService, 'showInfo')
updateSpy.mockImplementation(() =>
throwError(() => new HttpErrorResponse({ status: 403 }))
throwError(() => new Error('failed to save'))
)
component.save(true)
expect(updateSpy).toHaveBeenCalled()

View File

@@ -824,13 +824,11 @@ export class DocumentDetailComponent
},
error: (error) => {
this.networkActive = false
if (error.status === 403) {
// e.g. document was 'given away'
this.openDocumentService.setDirty(this.document, false)
if (!this.userCanEdit) {
this.toastService.showInfo(
$localize`Document "${this.document.title}" saved successfully.`
)
this.close()
close && this.close()
} else {
this.error = error.error
this.toastService.showError(