Fix: require only change permissions for task dismissal, add frontend error handling (#11023)

This commit is contained in:
shamoon
2025-10-07 00:56:16 -07:00
committed by GitHub
parent 79b30fbade
commit df86882e8e
7 changed files with 124 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http'
import { Injectable, inject } from '@angular/core'
import { Observable, Subject } from 'rxjs'
import { first, takeUntil } from 'rxjs/operators'
import { first, takeUntil, tap } from 'rxjs/operators'
import {
PaperlessTask,
PaperlessTaskName,
@@ -68,14 +68,17 @@ export class TasksService {
}
public dismissTasks(task_ids: Set<number>) {
this.http
return this.http
.post(`${this.baseUrl}tasks/acknowledge/`, {
tasks: [...task_ids],
})
.pipe(first())
.subscribe((r) => {
this.reload()
})
.pipe(
first(),
takeUntil(this.unsubscribeNotifer),
tap(() => {
this.reload()
})
)
}
public cancelPending(): void {