mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Fix: Always retrieve sidebar views from service (#4619)
This commit is contained in:
		@@ -87,12 +87,12 @@
 | 
				
			|||||||
          </li>
 | 
					          </li>
 | 
				
			||||||
        </ul>
 | 
					        </ul>
 | 
				
			||||||
        <ng-container *pngxIfPermissions="{ action: PermissionAction.View, type: PermissionType.SavedView }">
 | 
					        <ng-container *pngxIfPermissions="{ action: PermissionAction.View, type: PermissionType.SavedView }">
 | 
				
			||||||
          <h6 class="sidebar-heading px-3 mt-3 mb-1 text-muted" *ngIf='savedViewService.loading || sidebarViews?.length > 0'>
 | 
					          <h6 class="sidebar-heading px-3 mt-3 mb-1 text-muted" *ngIf='savedViewService.loading || savedViewService.sidebarViews?.length > 0'>
 | 
				
			||||||
            <span i18n>Saved views</span>
 | 
					            <span i18n>Saved views</span>
 | 
				
			||||||
            <div *ngIf="savedViewService.loading" class="spinner-border spinner-border-sm fw-normal ms-2" role="status"></div>
 | 
					            <div *ngIf="savedViewService.loading" class="spinner-border spinner-border-sm fw-normal ms-2" role="status"></div>
 | 
				
			||||||
          </h6>
 | 
					          </h6>
 | 
				
			||||||
          <ul class="nav flex-column mb-2" cdkDropList (cdkDropListDropped)="onDrop($event)">
 | 
					          <ul class="nav flex-column mb-2" cdkDropList (cdkDropListDropped)="onDrop($event)">
 | 
				
			||||||
            <li class="nav-item w-100" *ngFor="let view of sidebarViews"
 | 
					            <li class="nav-item w-100" *ngFor="let view of savedViewService.sidebarViews"
 | 
				
			||||||
              cdkDrag
 | 
					              cdkDrag
 | 
				
			||||||
              [cdkDragDisabled]="!settingsService.organizingSidebarSavedViews"
 | 
					              [cdkDragDisabled]="!settingsService.organizingSidebarSavedViews"
 | 
				
			||||||
              cdkDragPreviewContainer="parent"
 | 
					              cdkDragPreviewContainer="parent"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,8 +58,6 @@ export class AppFrameComponent
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  searchField = new FormControl('')
 | 
					  searchField = new FormControl('')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  sidebarViews: PaperlessSavedView[]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  constructor(
 | 
					  constructor(
 | 
				
			||||||
    public router: Router,
 | 
					    public router: Router,
 | 
				
			||||||
    private activatedRoute: ActivatedRoute,
 | 
					    private activatedRoute: ActivatedRoute,
 | 
				
			||||||
@@ -90,10 +88,6 @@ export class AppFrameComponent
 | 
				
			|||||||
      this.checkForUpdates()
 | 
					      this.checkForUpdates()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    this.tasksService.reload()
 | 
					    this.tasksService.reload()
 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.savedViewService.listAll().subscribe(() => {
 | 
					 | 
				
			||||||
      this.sidebarViews = this.savedViewService.sidebarViews
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  toggleSlimSidebar(): void {
 | 
					  toggleSlimSidebar(): void {
 | 
				
			||||||
@@ -240,9 +234,10 @@ export class AppFrameComponent
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  onDrop(event: CdkDragDrop<PaperlessSavedView[]>) {
 | 
					  onDrop(event: CdkDragDrop<PaperlessSavedView[]>) {
 | 
				
			||||||
    moveItemInArray(this.sidebarViews, event.previousIndex, event.currentIndex)
 | 
					    const sidebarViews = this.savedViewService.sidebarViews.concat([])
 | 
				
			||||||
 | 
					    moveItemInArray(sidebarViews, event.previousIndex, event.currentIndex)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.settingsService.updateSidebarViewsSort(this.sidebarViews).subscribe({
 | 
					    this.settingsService.updateSidebarViewsSort(sidebarViews).subscribe({
 | 
				
			||||||
      next: () => {
 | 
					      next: () => {
 | 
				
			||||||
        this.toastService.showInfo($localize`Sidebar views updated`)
 | 
					        this.toastService.showInfo($localize`Sidebar views updated`)
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user