@@ -15,6 +15,7 @@ import { DI } from '@/di-symbols.js';
15
15
import { GlobalEventService } from '@/core/GlobalEventService.js' ;
16
16
import { L_CHARS , secureRndstr } from '@/misc/secure-rndstr.js' ;
17
17
import { UserAuthService } from '@/core/UserAuthService.js' ;
18
+ import { MetaService } from '@/core/MetaService.js' ;
18
19
import { ApiError } from '../../error.js' ;
19
20
20
21
export const meta = {
@@ -46,6 +47,12 @@ export const meta = {
46
47
code : 'UNAVAILABLE' ,
47
48
id : 'a2defefb-f220-8849-0af6-17f816099323' ,
48
49
} ,
50
+
51
+ emailRequired : {
52
+ message : 'Email address is required.' ,
53
+ code : 'EMAIL_REQUIRED' ,
54
+ id : '324c7a88-59f2-492f-903f-89134f93e47e' ,
55
+ } ,
49
56
} ,
50
57
51
58
res : {
@@ -73,6 +80,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
73
80
@Inject ( DI . userProfilesRepository )
74
81
private userProfilesRepository : UserProfilesRepository ,
75
82
83
+ private metaService : MetaService ,
76
84
private userEntityService : UserEntityService ,
77
85
private emailService : EmailService ,
78
86
private userAuthService : UserAuthService ,
@@ -100,6 +108,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
100
108
if ( ! res . available ) {
101
109
throw new ApiError ( meta . errors . unavailable ) ;
102
110
}
111
+ } else if ( ( await this . metaService . fetch ( ) ) . emailRequiredForSignup ) {
112
+ throw new ApiError ( meta . errors . emailRequired ) ;
103
113
}
104
114
105
115
await this . userProfilesRepository . update ( me . id , {
0 commit comments