mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-09 08:01:46 +00:00
Fixhancement: rework saved view widget queue processing to expected (#14699)
* activateSavedViewWithDocuments, move most of loadSavedView to a helper * Consolidate the page size thing * Pass widget's documents to list service fpr next / previous * Tests for the page size + widget click * Fix close from a dashboard widget list
This commit is contained in:
1 parent
e88303cc16
commit
c5239f9f74
8 files changed
+150
-13
No files matched your search
@@ -940,6 +940,20 @@ describe('DocumentDetailComponent', () => {
|
||||
expect(navigateSpy).toHaveBeenCalledWith(['view', 77])
|
||||
})
|
||||
|
||||
it('should close back to the dashboard even if a saved view is active', () => {
|
||||
initNormally()
|
||||
jest
|
||||
.spyOn(componentRouterService, 'getComponentURLBefore')
|
||||
.mockReturnValue('dashboard')
|
||||
jest
|
||||
.spyOn(documentListViewService, 'activeSavedViewId', 'get')
|
||||
.mockReturnValue(77)
|
||||
const navigateSpy = jest.spyOn(router, 'navigate')
|
||||
component.close()
|
||||
expect(navigateSpy).toHaveBeenCalledWith(['dashboard'])
|
||||
expect(navigateSpy).not.toHaveBeenCalledWith(['view', 77])
|
||||
})
|
||||
|
||||
it('should not close if e.g. user-cancelled', () => {
|
||||
initNormally()
|
||||
jest.spyOn(openDocumentsService, 'closeDocument').mockReturnValue(of(false))
|
||||
|
||||
@@ -1454,7 +1454,12 @@ export class DocumentDetailComponent
|
||||
.subscribe((closed) => {
|
||||
if (!closed) return
|
||||
if (closedCallback) closedCallback()
|
||||
if (this.documentListViewService.activeSavedViewId) {
|
||||
if (
|
||||
this.componentRouterService.getComponentURLBefore() === 'dashboard'
|
||||
) {
|
||||
// e.g. opened from a dashboard widget
|
||||
this.router.navigate(['dashboard'])
|
||||
} else if (this.documentListViewService.activeSavedViewId) {
|
||||
this.router.navigate([
|
||||
'view',
|
||||
this.documentListViewService.activeSavedViewId,
|
||||
|
||||
Reference in new issue
Block a user