X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fmoderation%2Fregistration-list%2Fprocess-registration-modal.component.ts;h=3a7e5dea138449e6710f54ce7d6fb665995dac6f;hb=27aba6e9ea566debec1707c4cc22019cf71b076c;hp=fbe8deb41220941e4f3e8bd0d61afd6bed8e5abc;hpb=9589907c89d29a6c0acd52c8cb789af9f93ce9af;p=github%2FChocobozzz%2FPeerTube.git 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 ngOnInit () { this.buildForm({ - moderationResponse: REGISTRATION_MODERATION_RESPONSE_VALIDATOR + moderationResponse: REGISTRATION_MODERATION_RESPONSE_VALIDATOR, + preventEmailDelivery: null }) } @@ -50,6 +51,10 @@ export class ProcessRegistrationModalComponent extends FormReactive implements O this.processMode = mode this.registration = registration + this.form.patchValue({ + preventEmailDelivery: !this.isEmailEnabled() || registration.emailVerified !== true + }) + this.openedModal = this.modalService.open(this.modal, { centered: true }) } @@ -77,31 +82,41 @@ export class ProcessRegistrationModalComponent extends FormReactive implements O return this.server.getHTMLConfig().email.enabled } - private acceptRegistration () { - this.registrationService.acceptRegistration(this.registration, this.form.value.moderationResponse) - .subscribe({ - next: () => { - this.notifier.success($localize`${this.registration.username} account created`) - - this.registrationProcessed.emit() - this.hide() - }, + isPreventEmailDeliveryChecked () { + return this.form.value.preventEmailDelivery + } - error: err => this.notifier.error(err.message) - }) + private acceptRegistration () { + this.registrationService.acceptRegistration({ + registration: this.registration, + moderationResponse: this.form.value.moderationResponse, + preventEmailDelivery: this.form.value.preventEmailDelivery + }).subscribe({ + next: () => { + this.notifier.success($localize`${this.registration.username} account created`) + + this.registrationProcessed.emit() + this.hide() + }, + + error: err => this.notifier.error(err.message) + }) } private rejectRegistration () { - this.registrationService.rejectRegistration(this.registration, this.form.value.moderationResponse) - .subscribe({ - next: () => { - this.notifier.success($localize`${this.registration.username} registration rejected`) - - this.registrationProcessed.emit() - this.hide() - }, - - error: err => this.notifier.error(err.message) - }) + this.registrationService.rejectRegistration({ + registration: this.registration, + moderationResponse: this.form.value.moderationResponse, + preventEmailDelivery: this.form.value.preventEmailDelivery + }).subscribe({ + next: () => { + this.notifier.success($localize`${this.registration.username} registration rejected`) + + this.registrationProcessed.emit() + this.hide() + }, + + error: err => this.notifier.error(err.message) + }) } }