aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts')
-rw-r--r--client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts61
1 files changed, 38 insertions, 23 deletions
diff --git a/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts b/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts
index fbe8deb41..3a7e5dea1 100644
--- a/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts
+++ b/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.ts
@@ -34,7 +34,8 @@ export class ProcessRegistrationModalComponent extends FormReactive implements O
34 34
35 ngOnInit () { 35 ngOnInit () {
36 this.buildForm({ 36 this.buildForm({
37 moderationResponse: REGISTRATION_MODERATION_RESPONSE_VALIDATOR 37 moderationResponse: REGISTRATION_MODERATION_RESPONSE_VALIDATOR,
38 preventEmailDelivery: null
38 }) 39 })
39 } 40 }
40 41
@@ -50,6 +51,10 @@ export class ProcessRegistrationModalComponent extends FormReactive implements O
50 this.processMode = mode 51 this.processMode = mode
51 this.registration = registration 52 this.registration = registration
52 53
54 this.form.patchValue({
55 preventEmailDelivery: !this.isEmailEnabled() || registration.emailVerified !== true
56 })
57
53 this.openedModal = this.modalService.open(this.modal, { centered: true }) 58 this.openedModal = this.modalService.open(this.modal, { centered: true })
54 } 59 }
55 60
@@ -77,31 +82,41 @@ export class ProcessRegistrationModalComponent extends FormReactive implements O
77 return this.server.getHTMLConfig().email.enabled 82 return this.server.getHTMLConfig().email.enabled
78 } 83 }
79 84
80 private acceptRegistration () { 85 isPreventEmailDeliveryChecked () {
81 this.registrationService.acceptRegistration(this.registration, this.form.value.moderationResponse) 86 return this.form.value.preventEmailDelivery
82 .subscribe({ 87 }
83 next: () => {
84 this.notifier.success($localize`${this.registration.username} account created`)
85
86 this.registrationProcessed.emit()
87 this.hide()
88 },
89 88
90 error: err => this.notifier.error(err.message) 89 private acceptRegistration () {
91 }) 90 this.registrationService.acceptRegistration({
91 registration: this.registration,
92 moderationResponse: this.form.value.moderationResponse,
93 preventEmailDelivery: this.form.value.preventEmailDelivery
94 }).subscribe({
95 next: () => {
96 this.notifier.success($localize`${this.registration.username} account created`)
97
98 this.registrationProcessed.emit()
99 this.hide()
100 },
101
102 error: err => this.notifier.error(err.message)
103 })
92 } 104 }
93 105
94 private rejectRegistration () { 106 private rejectRegistration () {
95 this.registrationService.rejectRegistration(this.registration, this.form.value.moderationResponse) 107 this.registrationService.rejectRegistration({
96 .subscribe({ 108 registration: this.registration,
97 next: () => { 109 moderationResponse: this.form.value.moderationResponse,
98 this.notifier.success($localize`${this.registration.username} registration rejected`) 110 preventEmailDelivery: this.form.value.preventEmailDelivery
99 111 }).subscribe({
100 this.registrationProcessed.emit() 112 next: () => {
101 this.hide() 113 this.notifier.success($localize`${this.registration.username} registration rejected`)
102 }, 114
103 115 this.registrationProcessed.emit()
104 error: err => this.notifier.error(err.message) 116 this.hide()
105 }) 117 },
118
119 error: err => this.notifier.error(err.message)
120 })
106 } 121 }
107} 122}