mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-11-08 07:43:41 -05:00
Fix: use original object for children in tag list (#11127)
This commit is contained in:
parent
78893292f8
commit
31cee7481b
@ -140,7 +140,7 @@
|
|||||||
|
|
||||||
@if (object.children && object.children.length > 0) {
|
@if (object.children && object.children.length > 0) {
|
||||||
@for (child of object.children; track child) {
|
@for (child of object.children; track child) {
|
||||||
<ng-container [ngTemplateOutlet]="objectRow" [ngTemplateOutletContext]="{ object: child, depth: depth + 1 }"></ng-container>
|
<ng-container [ngTemplateOutlet]="objectRow" [ngTemplateOutletContext]="{ object: getOriginalObject(child), depth: depth + 1 }"></ng-container>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@ -347,4 +347,18 @@ describe('ManagementListComponent', () => {
|
|||||||
expect(component.userCanBulkEdit(PermissionAction.Delete)).toBeFalsy()
|
expect(component.userCanBulkEdit(PermissionAction.Delete)).toBeFalsy()
|
||||||
expect(component.userCanBulkEdit(PermissionAction.Change)).toBeFalsy()
|
expect(component.userCanBulkEdit(PermissionAction.Change)).toBeFalsy()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should return an original object from filtered child object', () => {
|
||||||
|
const childTag: Tag = {
|
||||||
|
id: 4,
|
||||||
|
name: 'Child Tag',
|
||||||
|
matching_algorithm: MATCH_LITERAL,
|
||||||
|
match: 'child',
|
||||||
|
document_count: 10,
|
||||||
|
parent: 1,
|
||||||
|
}
|
||||||
|
component['unfilteredData'].push(childTag)
|
||||||
|
const original = component.getOriginalObject({ id: 4 } as Tag)
|
||||||
|
expect(original).toEqual(childTag)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -145,6 +145,10 @@ export abstract class ManagementListComponent<T extends MatchingModel>
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getOriginalObject(object: T): T {
|
||||||
|
return this.unfilteredData.find((d) => d.id == object.id)
|
||||||
|
}
|
||||||
|
|
||||||
reloadData(extraParams: { [key: string]: any } = null) {
|
reloadData(extraParams: { [key: string]: any } = null) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.clearSelection()
|
this.clearSelection()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user