mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-16 00:19:32 -06:00
Fix discard goes to wrong version content
This commit is contained in:
@@ -688,6 +688,18 @@ describe('DocumentDetailComponent', () => {
|
|||||||
expect(navigateSpy).toHaveBeenCalledWith(['404'], { replaceUrl: true })
|
expect(navigateSpy).toHaveBeenCalledWith(['404'], { replaceUrl: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('discard should request the currently selected version', () => {
|
||||||
|
initNormally()
|
||||||
|
const getSpy = jest.spyOn(documentService, 'get')
|
||||||
|
getSpy.mockClear()
|
||||||
|
getSpy.mockReturnValueOnce(of(doc))
|
||||||
|
|
||||||
|
component.selectedVersionId = 10
|
||||||
|
component.discard()
|
||||||
|
|
||||||
|
expect(getSpy).toHaveBeenCalledWith(component.documentId, 10)
|
||||||
|
})
|
||||||
|
|
||||||
it('should 404 on invalid id', () => {
|
it('should 404 on invalid id', () => {
|
||||||
const navigateSpy = jest.spyOn(router, 'navigate')
|
const navigateSpy = jest.spyOn(router, 'navigate')
|
||||||
jest
|
jest
|
||||||
|
|||||||
@@ -1059,7 +1059,7 @@ export class DocumentDetailComponent
|
|||||||
|
|
||||||
discard() {
|
discard() {
|
||||||
this.documentsService
|
this.documentsService
|
||||||
.get(this.documentId)
|
.get(this.documentId, this.selectedVersionId)
|
||||||
.pipe(
|
.pipe(
|
||||||
first(),
|
first(),
|
||||||
takeUntil(this.unsubscribeNotifier),
|
takeUntil(this.unsubscribeNotifier),
|
||||||
|
|||||||
Reference in New Issue
Block a user