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
refactor(frontend:files): introduce `openedFile` for cleaner dialog state management
johaven4b6c5b7a4694
diff --git a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.tsindex af96774c..52785751 100644--- a/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts+++ b/frontend/src/app/applications/files/components/dialogs/files-viewer-dialog.component.ts@@ -26,11 +26,13 @@ export class FilesViewerDialogComponent implements OnInit, OnDestroy {@Input({ required: true }) shortMime: stringprotected currentHeight: numberprotected directoryImages = computed(() => this.directoryFiles.filter((file) => file.isImage))+ private openedFile: { id: string | number; name: string; mimeUrl: string }private readonly layout = inject(LayoutService)private readonly subscription: Subscription = this.layout.resizeEvent.subscribe(() => this.onResize())private readonly offsetTop = 42ngOnInit() {+ this.openedFile = { id: this.currentFile.id, name: this.currentFile.name, mimeUrl: this.currentFile.mimeUrl }this.onResize()}@@ -39,11 +41,11 @@ export class FilesViewerDialogComponent implements OnInit, OnDestroy {}onClose() {- this.layout.closeDialog(null, this.currentFile.id)+ this.layout.closeDialog(null, this.openedFile.id)}onMinimize() {- this.layout.minimizeDialog(this.currentFile.id, { name: this.currentFile.name, mimeUrl: this.currentFile.mimeUrl })+ this.layout.minimizeDialog(this.openedFile.id, { name: this.openedFile.name, mimeUrl: this.openedFile.mimeUrl })}private onResize() {diff --git a/frontend/src/app/applications/files/services/files.service.ts b/frontend/src/app/applications/files/services/files.service.tsindex 0f3e9388..0a0d0feb 100644--- a/frontend/src/app/applications/files/services/files.service.ts+++ b/frontend/src/app/applications/files/services/files.service.ts@@ -232,12 +232,12 @@ export class FilesService {try {shortMime = await this.viewerHook(mode, currentFile)} catch {- // OnlyOffice not enabled, falling back to download+ // OnlyOffice isn't enabled, falling back to downloadthis.download(currentFile)return}this.layout.openDialog(FilesViewerDialogComponent, 'full', {- id: currentFile.id,+ id: currentFile.id, // only used to manage the modalinitialState: {currentFile: currentFile,directoryFiles: directoryFiles,