Enhancement: use patch instead of put for frontend document changes (#9744)

This commit is contained in:
shamoon
2025-04-22 12:58:28 -07:00
committed by GitHub
parent 2abf38f98e
commit cbaceb95af
4 changed files with 54 additions and 31 deletions

View File

@@ -268,15 +268,15 @@ describe(`DocumentService`, () => {
expect(req.request.method).toEqual('GET')
})
it('should pass remove_inbox_tags setting to update', () => {
subscription = service.update(documents[0]).subscribe()
it('should pass remove_inbox_tags setting to patch', () => {
subscription = service.patch(documents[0]).subscribe()
let req = httpTestingController.expectOne(
`${environment.apiBaseUrl}${endpoint}/${documents[0].id}/`
)
expect(req.request.body.remove_inbox_tags).toEqual(false)
settingsService.set(SETTINGS_KEYS.DOCUMENT_EDITING_REMOVE_INBOX_TAGS, true)
subscription = service.update(documents[0]).subscribe()
subscription = service.patch(documents[0]).subscribe()
req = httpTestingController.expectOne(
`${environment.apiBaseUrl}${endpoint}/${documents[0].id}/`
)

View File

@@ -189,13 +189,13 @@ export class DocumentService extends AbstractPaperlessService<Document> {
return this.http.get<number>(this.getResourceUrl(null, 'next_asn'))
}
update(o: Document): Observable<Document> {
patch(o: Document): Observable<Document> {
// we want to only set created_date
o.created = undefined
delete o.created
o.remove_inbox_tags = !!this.settingsService.get(
SETTINGS_KEYS.DOCUMENT_EDITING_REMOVE_INBOX_TAGS
)
return super.update(o)
return super.patch(o)
}
uploadDocument(formData) {