]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix mail account / rule delete
authorMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Fri, 18 Nov 2022 22:10:17 +0000 (14:10 -0800)
committerMichael Shamoon <4887959+shamoon@users.noreply.github.com>
Sat, 3 Dec 2022 17:31:23 +0000 (09:31 -0800)
src-ui/src/app/components/manage/settings/settings.component.ts

index fc072aeee0201dc8758460556d300a428f574ebb..fbb41b9720df8885fd33923aa8ad04ba9345974b 100644 (file)
@@ -543,7 +543,22 @@ export class SettingsComponent
     modal.componentInstance.btnCaption = $localize`Proceed`
     modal.componentInstance.confirmClicked.subscribe(() => {
       modal.componentInstance.buttonsEnabled = false
-      this.mailAccountService.delete(account)
+      this.mailAccountService.delete(account).subscribe({
+        next: () => {
+          modal.close()
+          this.toastService.showInfo($localize`Deleted mail account`)
+          this.mailAccountService.clearCache()
+          this.mailAccountService.listAll().subscribe((r) => {
+            this.mailAccounts = r.results
+            this.initialize()
+          })
+        },
+        error: (e) => {
+          this.toastService.showError(
+            $localize`Error deleting mail account: ${e.toString()}.`
+          )
+        },
+      })
     })
   }
 
@@ -586,7 +601,22 @@ export class SettingsComponent
     modal.componentInstance.btnCaption = $localize`Proceed`
     modal.componentInstance.confirmClicked.subscribe(() => {
       modal.componentInstance.buttonsEnabled = false
-      this.mailRuleService.delete(rule)
+      this.mailRuleService.delete(rule).subscribe({
+        next: () => {
+          modal.close()
+          this.toastService.showInfo($localize`Deleted mail rule`)
+          this.mailRuleService.clearCache()
+          this.mailRuleService.listAll().subscribe((r) => {
+            this.mailRules = r.results
+            this.initialize()
+          })
+        },
+        error: (e) => {
+          this.toastService.showError(
+            $localize`Error deleting mail rule: ${e.toString()}.`
+          )
+        },
+      })
     })
   }
 }