From 4115f20084f302f497be9cb12237564679ca54ec Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 20 Jan 2023 15:34:01 +0100 Subject: Add ability to not send an email for registration --- .../admin-registration.service.ts | 22 ++++++-- .../process-registration-modal.component.html | 13 +++-- .../process-registration-modal.component.ts | 61 ++++++++++++++-------- .../shared/form-validators/form-validator.model.ts | 2 +- 4 files changed, 66 insertions(+), 32 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/+admin/moderation/registration-list/admin-registration.service.ts b/client/src/app/+admin/moderation/registration-list/admin-registration.service.ts index 10e2938c7..a9f13cf2f 100644 --- a/client/src/app/+admin/moderation/registration-list/admin-registration.service.ts +++ b/client/src/app/+admin/moderation/registration-list/admin-registration.service.ts @@ -5,7 +5,7 @@ import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' import { arrayify } from '@shared/core-utils' -import { ResultList, UserRegistration } from '@shared/models' +import { ResultList, UserRegistration, UserRegistrationUpdateState } from '@shared/models' import { environment } from '../../../../environments/environment' @Injectable() @@ -40,17 +40,29 @@ export class AdminRegistrationService { ) } - acceptRegistration (registration: UserRegistration, moderationResponse: string) { + acceptRegistration (options: { + registration: UserRegistration + moderationResponse: string + preventEmailDelivery: boolean + }) { + const { registration, moderationResponse, preventEmailDelivery } = options + const url = AdminRegistrationService.BASE_REGISTRATION_URL + '/' + registration.id + '/accept' - const body = { moderationResponse } + const body: UserRegistrationUpdateState = { moderationResponse, preventEmailDelivery } return this.authHttp.post(url, body) .pipe(catchError(res => this.restExtractor.handleError(res))) } - rejectRegistration (registration: UserRegistration, moderationResponse: string) { + rejectRegistration (options: { + registration: UserRegistration + moderationResponse: string + preventEmailDelivery: boolean + }) { + const { registration, moderationResponse, preventEmailDelivery } = options + const url = AdminRegistrationService.BASE_REGISTRATION_URL + '/' + registration.id + '/reject' - const body = { moderationResponse } + const body: UserRegistrationUpdateState = { moderationResponse, preventEmailDelivery } return this.authHttp.post(url, body) .pipe(catchError(res => this.restExtractor.handleError(res))) diff --git a/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.html b/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.html index 7a33bb94b..8e46b0cf9 100644 --- a/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.html +++ b/client/src/app/+admin/moderation/registration-list/process-registration-modal.component.html @@ -12,7 +12,7 @@ + +
+ +