mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-19 10:19:27 -05:00
fix settings change detection on delete
This commit is contained in:
parent
ee7653a8cd
commit
72efb24b73
@ -282,6 +282,8 @@ export class SettingsComponent
|
|||||||
let storeData = this.getCurrentSettings()
|
let storeData = this.getCurrentSettings()
|
||||||
|
|
||||||
if (this.savedViews) {
|
if (this.savedViews) {
|
||||||
|
this.emptyGroup(this.savedViewGroup)
|
||||||
|
|
||||||
for (let view of this.savedViews) {
|
for (let view of this.savedViews) {
|
||||||
storeData.savedViews[view.id.toString()] = {
|
storeData.savedViews[view.id.toString()] = {
|
||||||
id: view.id,
|
id: view.id,
|
||||||
@ -302,6 +304,9 @@ export class SettingsComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.users && this.groups) {
|
if (this.users && this.groups) {
|
||||||
|
this.emptyGroup(this.usersGroup)
|
||||||
|
this.emptyGroup(this.groupsGroup)
|
||||||
|
|
||||||
for (let user of this.users) {
|
for (let user of this.users) {
|
||||||
storeData.usersGroup[user.id.toString()] = {
|
storeData.usersGroup[user.id.toString()] = {
|
||||||
id: user.id,
|
id: user.id,
|
||||||
@ -346,6 +351,9 @@ export class SettingsComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.mailAccounts && this.mailRules) {
|
if (this.mailAccounts && this.mailRules) {
|
||||||
|
this.emptyGroup(this.mailAccountGroup)
|
||||||
|
this.emptyGroup(this.mailRuleGroup)
|
||||||
|
|
||||||
for (let account of this.mailAccounts) {
|
for (let account of this.mailAccounts) {
|
||||||
storeData.mailAccounts[account.id.toString()] = {
|
storeData.mailAccounts[account.id.toString()] = {
|
||||||
id: account.id,
|
id: account.id,
|
||||||
@ -448,6 +456,10 @@ export class SettingsComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private emptyGroup(group: FormGroup) {
|
||||||
|
Object.keys(group.controls).forEach((key) => group.removeControl(key))
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
if (this.isDirty) this.settings.updateAppearanceSettings() // in case user changed appearance but didnt save
|
if (this.isDirty) this.settings.updateAppearanceSettings() // in case user changed appearance but didnt save
|
||||||
this.storeSub && this.storeSub.unsubscribe()
|
this.storeSub && this.storeSub.unsubscribe()
|
||||||
@ -460,6 +472,11 @@ export class SettingsComponent
|
|||||||
this.toastService.showInfo(
|
this.toastService.showInfo(
|
||||||
$localize`Saved view "${savedView.name}" deleted.`
|
$localize`Saved view "${savedView.name}" deleted.`
|
||||||
)
|
)
|
||||||
|
this.savedViewService.clearCache()
|
||||||
|
this.savedViewService.listAll().subscribe((r) => {
|
||||||
|
this.savedViews = r.results
|
||||||
|
this.initialize(true)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,7 +682,7 @@ export class SettingsComponent
|
|||||||
this.toastService.showInfo($localize`Deleted user`)
|
this.toastService.showInfo($localize`Deleted user`)
|
||||||
this.usersService.listAll().subscribe((r) => {
|
this.usersService.listAll().subscribe((r) => {
|
||||||
this.users = r.results
|
this.users = r.results
|
||||||
this.initialize()
|
this.initialize(true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
error: (e) => {
|
error: (e) => {
|
||||||
@ -719,7 +736,7 @@ export class SettingsComponent
|
|||||||
this.toastService.showInfo($localize`Deleted group`)
|
this.toastService.showInfo($localize`Deleted group`)
|
||||||
this.groupsService.listAll().subscribe((r) => {
|
this.groupsService.listAll().subscribe((r) => {
|
||||||
this.groups = r.results
|
this.groups = r.results
|
||||||
this.initialize()
|
this.initialize(true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
error: (e) => {
|
error: (e) => {
|
||||||
@ -781,7 +798,7 @@ export class SettingsComponent
|
|||||||
this.mailAccountService.clearCache()
|
this.mailAccountService.clearCache()
|
||||||
this.mailAccountService.listAll().subscribe((r) => {
|
this.mailAccountService.listAll().subscribe((r) => {
|
||||||
this.mailAccounts = r.results
|
this.mailAccounts = r.results
|
||||||
this.initialize()
|
this.initialize(true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
error: (e) => {
|
error: (e) => {
|
||||||
@ -811,7 +828,7 @@ export class SettingsComponent
|
|||||||
this.mailRuleService.listAll().subscribe((r) => {
|
this.mailRuleService.listAll().subscribe((r) => {
|
||||||
this.mailRules = r.results
|
this.mailRules = r.results
|
||||||
|
|
||||||
this.initialize()
|
this.initialize(true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
error: (e) => {
|
error: (e) => {
|
||||||
@ -840,7 +857,7 @@ export class SettingsComponent
|
|||||||
this.mailRuleService.clearCache()
|
this.mailRuleService.clearCache()
|
||||||
this.mailRuleService.listAll().subscribe((r) => {
|
this.mailRuleService.listAll().subscribe((r) => {
|
||||||
this.mailRules = r.results
|
this.mailRules = r.results
|
||||||
this.initialize()
|
this.initialize(true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
error: (e) => {
|
error: (e) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user