]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Alphabetize tags by default 1017/head
authorMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Tue, 24 May 2022 03:25:26 +0000 (20:25 -0700)
committerMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Tue, 24 May 2022 03:25:26 +0000 (20:25 -0700)
src-ui/src/app/services/rest/document.service.ts

index 8d5f80c04d059d657836eda46495be753ce096ea..8b5248b860627ce79cc5cc718ad9e6787f0e8ce3 100644 (file)
@@ -6,7 +6,7 @@ import { HttpClient, HttpParams } from '@angular/common/http'
 import { Observable } from 'rxjs'
 import { Results } from 'src/app/data/results'
 import { FilterRule } from 'src/app/data/filter-rule'
-import { map } from 'rxjs/operators'
+import { map, tap } from 'rxjs/operators'
 import { CorrespondentService } from './correspondent.service'
 import { DocumentTypeService } from './document-type.service'
 import { TagService } from './tag.service'
@@ -70,7 +70,13 @@ export class DocumentService extends AbstractPaperlessService<PaperlessDocument>
       doc.document_type$ = this.documentTypeService.getCached(doc.document_type)
     }
     if (doc.tags) {
-      doc.tags$ = this.tagService.getCachedMany(doc.tags)
+      doc.tags$ = this.tagService
+        .getCachedMany(doc.tags)
+        .pipe(
+          tap((tags) =>
+            tags.sort((tagA, tagB) => tagA.name.localeCompare(tagB.name))
+          )
+        )
     }
     if (doc.storage_path) {
       doc.storage_path$ = this.storagePathService.getCached(doc.storage_path)