Tweak: more verbose toast messages

This commit is contained in:
shamoon
2025-02-01 21:57:57 -08:00
parent e877beea4e
commit 065724befb
10 changed files with 248 additions and 184 deletions

View File

@@ -134,7 +134,7 @@ describe('UsersAndGroupsComponent', () => {
deleteSpy.mockReturnValueOnce(of(true))
deleteDialog.confirm()
expect(listAllSpy).toHaveBeenCalled()
expect(toastInfoSpy).toHaveBeenCalledWith('Deleted user')
expect(toastInfoSpy).toHaveBeenCalledWith('Deleted user "user1"')
})
it('should logout current user if password changed, after delay', fakeAsync(() => {
@@ -178,7 +178,7 @@ describe('UsersAndGroupsComponent', () => {
completeSetup()
let modal: NgbModalRef
modalService.activeInstances.subscribe((refs) => (modal = refs[0]))
component.deleteGroup(users[0])
component.deleteGroup(groups[0])
const deleteDialog = modal.componentInstance as ConfirmDialogComponent
const deleteSpy = jest.spyOn(groupService, 'delete')
const toastErrorSpy = jest.spyOn(toastService, 'showError')
@@ -192,7 +192,7 @@ describe('UsersAndGroupsComponent', () => {
deleteSpy.mockReturnValueOnce(of(true))
deleteDialog.confirm()
expect(listAllSpy).toHaveBeenCalled()
expect(toastInfoSpy).toHaveBeenCalledWith('Deleted group')
expect(toastInfoSpy).toHaveBeenCalledWith('Deleted group "group1"')
})
it('should get group name', () => {

View File

@@ -129,13 +129,16 @@ export class UsersAndGroupsComponent
this.usersService.delete(user).subscribe({
next: () => {
modal.close()
this.toastService.showInfo($localize`Deleted user`)
this.toastService.showInfo($localize`Deleted user "${user.username}"`)
this.usersService.listAll().subscribe((r) => {
this.users = r.results
})
},
error: (e) => {
this.toastService.showError($localize`Error deleting user.`, e)
this.toastService.showError(
$localize`Error deleting user "${user.username}".`,
e
)
},
})
})
@@ -179,13 +182,16 @@ export class UsersAndGroupsComponent
this.groupsService.delete(group).subscribe({
next: () => {
modal.close()
this.toastService.showInfo($localize`Deleted group`)
this.toastService.showInfo($localize`Deleted group "${group.name}"`)
this.groupsService.listAll().subscribe((r) => {
this.groups = r.results
})
},
error: (e) => {
this.toastService.showError($localize`Error deleting group.`, e)
this.toastService.showError(
$localize`Error deleting group "${group.name}".`,
e
)
},
})
})