Fix: saved views do not return to default display fields after setting and then removing (#9168)

This commit is contained in:
shamoon
2025-02-19 15:44:48 -08:00
committed by GitHub
parent 822c2d2d56
commit 3bf64ae7da
6 changed files with 88 additions and 12 deletions

View File

@@ -87,12 +87,21 @@ export class SavedViewService extends AbstractPaperlessService<SavedView> {
return super.create(o).pipe(tap(() => this.reload()))
}
update(o: SavedView) {
return super.update(o).pipe(tap(() => this.reload()))
patch(o: SavedView, reload: boolean = false): Observable<SavedView> {
if (o.display_fields?.length === 0) {
o.display_fields = null
}
return super.patch(o).pipe(
tap(() => {
if (reload) {
this.reload()
}
})
)
}
patchMany(objects: SavedView[]): Observable<SavedView[]> {
return combineLatest(objects.map((o) => super.patch(o))).pipe(
return combineLatest(objects.map((o) => this.patch(o, false))).pipe(
tap(() => this.reload())
)
}