1 import { AbstractControl, ValidationErrors, Validators } from '@angular/forms'
2 import { BuildFormValidator } from './form-validator.model'
4 export const OWNERSHIP_CHANGE_CHANNEL_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [ Validators.required ],
7 'required': $localize`The channel is required.`
11 export const OWNERSHIP_CHANGE_USERNAME_VALIDATOR: BuildFormValidator = {
12 VALIDATORS: [ Validators.required, localAccountValidator ],
14 'required': $localize`The username is required.`,
15 'localAccountOnly': $localize`You can only transfer ownership to a local account`
19 function localAccountValidator (control: AbstractControl): ValidationErrors {
20 if (control.value.includes('@')) {
21 return { 'localAccountOnly': true }