]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Just start the frontend
authorshamoon <4887959+shamoon@users.noreply.github.com>
Sun, 20 Apr 2025 04:57:06 +0000 (21:57 -0700)
committershamoon <4887959+shamoon@users.noreply.github.com>
Wed, 2 Jul 2025 18:01:44 +0000 (11:01 -0700)
[ci skip]

src-ui/src/app/components/document-detail/document-detail.component.ts
src-ui/src/app/data/document-suggestions.ts

index e8a05962c245e9dfa273649e8af52923bf41e044..33de2862f181fb2503ab22a37446848f0c8e3f55 100644 (file)
@@ -74,6 +74,7 @@ import { CustomFieldsService } from 'src/app/services/rest/custom-fields.service
 import { DocumentTypeService } from 'src/app/services/rest/document-type.service'
 import { DocumentService } from 'src/app/services/rest/document.service'
 import { StoragePathService } from 'src/app/services/rest/storage-path.service'
+import { TagService } from 'src/app/services/rest/tag.service'
 import { UserService } from 'src/app/services/rest/user.service'
 import { SettingsService } from 'src/app/services/settings.service'
 import { ToastService } from 'src/app/services/toast.service'
@@ -641,25 +642,30 @@ export class DocumentDetailComponent
         PermissionType.Document
       )
     ) {
-      this.documentsService
-        .getSuggestions(doc.id)
-        .pipe(
-          first(),
-          takeUntil(this.unsubscribeNotifier),
-          takeUntil(this.docChangeNotifier)
-        )
-        .subscribe({
-          next: (result) => {
-            this.suggestions = result
-          },
-          error: (error) => {
-            this.suggestions = null
-            this.toastService.showError(
-              $localize`Error retrieving suggestions.`,
-              error
+      this.tagService.getCachedMany(doc.tags).subscribe((tags) => {
+        // only show suggestions if document has inbox tags
+        if (tags.some((tag) => tag.is_inbox_tag)) {
+          this.documentsService
+            .getSuggestions(doc.id)
+            .pipe(
+              first(),
+              takeUntil(this.unsubscribeNotifier),
+              takeUntil(this.docChangeNotifier)
             )
-          },
-        })
+            .subscribe({
+              next: (result) => {
+                this.suggestions = result
+              },
+              error: (error) => {
+                this.suggestions = null
+                this.toastService.showError(
+                  $localize`Error retrieving suggestions.`,
+                  error
+                )
+              },
+            })
+        }
+      })
     }
     this.title = this.documentTitlePipe.transform(doc.title)
     const docFormValues = Object.assign({}, doc)
index 85f9f9d22842fdb97bac4c47fd375f5067315dc0..8c7aca5157d63bb931cb843543fbe6cf58dc5f3f 100644 (file)
@@ -1,4 +1,6 @@
 export interface DocumentSuggestions {
+  title?: string
+
   tags?: number[]
 
   correspondents?: number[]