mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-19 10:19:27 -05:00
Frontend coerce empty display_fields to null
This commit is contained in:
parent
dac91c1e9a
commit
7f5f982a28
@ -114,6 +114,25 @@ describe(`Additional service tests for SavedViewService`, () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should treat empty display_fields as null', () => {
|
||||||
|
subscription = service
|
||||||
|
.patch({
|
||||||
|
id: 1,
|
||||||
|
name: 'Saved View',
|
||||||
|
show_on_dashboard: true,
|
||||||
|
show_in_sidebar: true,
|
||||||
|
sort_field: 'name',
|
||||||
|
sort_reverse: true,
|
||||||
|
filter_rules: [],
|
||||||
|
display_fields: [],
|
||||||
|
})
|
||||||
|
.subscribe()
|
||||||
|
const req = httpTestingController.expectOne(
|
||||||
|
`${environment.apiBaseUrl}${endpoint}/1/`
|
||||||
|
)
|
||||||
|
expect(req.request.body.display_fields).toBeNull()
|
||||||
|
})
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// Dont need to setup again
|
// Dont need to setup again
|
||||||
|
|
||||||
|
@ -87,8 +87,11 @@ export class SavedViewService extends AbstractPaperlessService<SavedView> {
|
|||||||
return super.create(o).pipe(tap(() => this.reload()))
|
return super.create(o).pipe(tap(() => this.reload()))
|
||||||
}
|
}
|
||||||
|
|
||||||
update(o: SavedView) {
|
patch(o: SavedView): Observable<SavedView> {
|
||||||
return super.update(o).pipe(tap(() => this.reload()))
|
if (o.display_fields?.length === 0) {
|
||||||
|
o.display_fields = null
|
||||||
|
}
|
||||||
|
return super.patch(o)
|
||||||
}
|
}
|
||||||
|
|
||||||
patchMany(objects: SavedView[]): Observable<SavedView[]> {
|
patchMany(objects: SavedView[]): Observable<SavedView[]> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user