]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Change: Revert dropdown sorting by doc count (#8887)
authorshamoon <4887959+shamoon@users.noreply.github.com>
Thu, 23 Jan 2025 23:52:35 +0000 (15:52 -0800)
committerGitHub <noreply@github.com>
Thu, 23 Jan 2025 23:52:35 +0000 (15:52 -0800)
src-ui/messages.xlf
src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.spec.ts
src-ui/src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts

index 4d628135c184ae5722dc04d245ab10dafaa257c3..9cc4086aeaf93a1aecb90f5fabaf3afd51eb63b3 100644 (file)
         <source>Not assigned</source>
         <context-group purpose="location">
           <context context-type="sourcefile">src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts</context>
-          <context context-type="linenumber">390</context>
+          <context context-type="linenumber">380</context>
         </context-group>
         <note priority="1" from="description">Filter drop down element to filter for documents with no correspondent/type/tag assigned</note>
       </trans-unit>
         <source>Open <x id="PH" equiv-text="this.title"/> filter</source>
         <context-group purpose="location">
           <context context-type="sourcefile">src/app/components/common/filterable-dropdown/filterable-dropdown.component.ts</context>
-          <context context-type="linenumber">511</context>
+          <context context-type="linenumber">501</context>
         </context-group>
       </trans-unit>
       <trans-unit id="7005745151564974365" datatype="html">
index 245d34830c6a4742854a2f848eb24865ea50d9eb..0dcc8c9cfb60f05602d20131b55532df37c58be3 100644 (file)
@@ -490,37 +490,6 @@ describe('FilterableDropdownComponent & FilterableDropdownSelectionModel', () =>
     ])
   })
 
-  it('selection model should sort items by state and document counts, if set', () => {
-    component.items = items.concat([{ id: 4, name: 'Item D' }])
-    component.selectionModel = selectionModel
-    component.documentCounts = [
-      { id: 1, document_count: 0 }, // Tag1
-      { id: 2, document_count: 1 }, // Tag2
-      { id: 4, document_count: 2 },
-    ]
-    component.selectionModel.apply()
-    expect(selectionModel.items).toEqual([
-      nullItem,
-      { id: 4, name: 'Item D' },
-      items[1], // Tag2
-      items[0], // Tag1
-    ])
-
-    selectionModel.toggle(items[1].id)
-    component.documentCounts = [
-      { id: 1, document_count: 0 },
-      { id: 2, document_count: 1 },
-      { id: 4, document_count: 0 },
-    ]
-    selectionModel.apply()
-    expect(selectionModel.items).toEqual([
-      nullItem,
-      items[1], // Tag2
-      { id: 4, name: 'Item D' },
-      items[0], // Tag1
-    ])
-  })
-
   it('should set support create, keep open model and call createRef method', fakeAsync(() => {
     component.items = items
     component.icon = 'tag-fill'
index 3f8ee0dc31c9f4301e51906e294471b082afd9e1..73b7fd27b6cd44cc2e5ad388518830c79965aa4a 100644 (file)
@@ -81,16 +81,6 @@ export class FilterableDropdownSelectionModel {
         this.getNonTemporary(b.id) == ToggleableItemState.NotSelected
       ) {
         return -1
-      } else if (
-        this._documentCounts.length &&
-        this.getDocumentCount(a.id) > this.getDocumentCount(b.id)
-      ) {
-        return -1
-      } else if (
-        this._documentCounts.length &&
-        this.getDocumentCount(a.id) < this.getDocumentCount(b.id)
-      ) {
-        return 1
       } else {
         return a.name.localeCompare(b.name)
       }