Skip to content

Commit 0ff54a1

Browse files
committed
fix(admin): send invitation to one member
* Sending an invitatoin via dialog for a single member did not send in a request also a requested name (tag in notification is {displayName}). The name filled in a dialog is now send as a part of the request, so it is also correctly send in an email notification.
1 parent 4a747f5 commit 0ff54a1

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

apps/admin-gui/src/app/shared/components/dialogs/invite-member-dialog/invite-member-dialog.component.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, Inject, OnInit } from '@angular/core';
22
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
3-
import { UntypedFormControl, ValidatorFn, Validators } from '@angular/forms';
3+
import { FormControl, ValidatorFn, Validators } from '@angular/forms';
44
import { TranslateService } from '@ngx-translate/core';
55
import { RegistrarManagerService } from '@perun-web-apps/perun/openapi';
66
import { NotificatorService, StoreService } from '@perun-web-apps/perun/services';
@@ -17,10 +17,10 @@ export interface InviteMemberDialogData {
1717
styleUrls: ['./invite-member-dialog.component.scss'],
1818
})
1919
export class InviteMemberDialogComponent implements OnInit {
20-
emailForm = new UntypedFormControl('', [Validators.required, Validators.email.bind(this)]);
20+
emailForm = new FormControl('', [Validators.required, Validators.email.bind(this)]);
2121
languages = ['en'];
2222
currentLanguage = 'en';
23-
name = new UntypedFormControl('', Validators.required as ValidatorFn);
23+
name = new FormControl('', Validators.required as ValidatorFn);
2424
loading = false;
2525
theme: string;
2626

@@ -49,38 +49,39 @@ export class InviteMemberDialogComponent implements OnInit {
4949
if (this.data.voId && !this.data.groupId) {
5050
this.loading = true;
5151
this.registrarManager
52-
.sendInvitation(this.emailForm.value as string, this.currentLanguage, this.data.voId)
53-
.subscribe(
54-
() => {
52+
.sendInvitation(this.emailForm.value, this.currentLanguage, this.data.voId, this.name.value)
53+
.subscribe({
54+
next: () => {
5555
this.translate
5656
.get('DIALOGS.INVITE_MEMBER.SUCCESS')
5757
.subscribe((successMessage: string) => {
5858
this.notificator.showSuccess(successMessage);
5959
this.dialogRef.close(true);
6060
});
6161
},
62-
() => (this.loading = false)
63-
);
62+
error: () => (this.loading = false),
63+
});
6464
} else {
6565
this.loading = true;
6666
this.registrarManager
6767
.sendInvitationForGroup(
68-
this.emailForm.value as string,
68+
this.emailForm.value,
6969
this.currentLanguage,
7070
this.data.voId,
71-
this.data.groupId
71+
this.data.groupId,
72+
this.name.value
7273
)
73-
.subscribe(
74-
() => {
74+
.subscribe({
75+
next: () => {
7576
this.translate
7677
.get('DIALOGS.INVITE_MEMBER.SUCCESS')
7778
.subscribe((successMessage: string) => {
7879
this.notificator.showSuccess(successMessage);
7980
this.dialogRef.close(true);
8081
});
8182
},
82-
() => (this.loading = false)
83-
);
83+
error: () => (this.loading = false),
84+
});
8485
}
8586
}
8687
}

0 commit comments

Comments
 (0)