Commit 5670b29 1 parent 02e85ca commit 5670b29 Copy full SHA for 5670b29
File tree 3 files changed +15
-4
lines changed
3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ watch(name, () => {
51
51
// 空文字列をnullにしたいので??は使うな
52
52
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
53
53
name: name.value || null,
54
+ }, undefined, {
55
+ 'SCREEN_NAME_CONTAINS_PROHIBITED_WORDS': {
56
+ title: i18n.ts.screenNameContainsProhibitedWords,
57
+ text: i18n.ts.screenNameContainsProhibitedWordsDescription,
58
+ },
54
59
});
55
60
});
56
61
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export const apiWithDialog = (<E extends keyof Misskey.Endpoints = keyof Misskey
35
35
endpoint : E ,
36
36
data : P = { } as any ,
37
37
token ?: string | null | undefined ,
38
+ customErrors ?: Record < string , { title ?: string ; text : string ; } > ,
38
39
) => {
39
40
const promise = misskeyApi ( endpoint , data , token ) ;
40
41
promiseDialog ( promise , null , async ( err ) => {
@@ -77,9 +78,9 @@ export const apiWithDialog = (<E extends keyof Misskey.Endpoints = keyof Misskey
77
78
} else if ( err . message . startsWith ( 'Unexpected token' ) ) {
78
79
title = i18n . ts . gotInvalidResponseError ;
79
80
text = i18n . ts . gotInvalidResponseErrorDescription ;
80
- } else if ( err . code === 'SCREEN_NAME_CONTAINS_PROHIBITED_WORDS' ) {
81
- title = i18n . ts . screenNameContainsProhibitedWords ;
82
- text = i18n . ts . screenNameContainsProhibitedWordsDescription ;
81
+ } else if ( customErrors && customErrors [ err . code ] != null ) {
82
+ title = customErrors [ err . code ] . title ;
83
+ text = customErrors [ err . code ] . text ;
83
84
}
84
85
alert ( {
85
86
type : 'error' ,
@@ -89,7 +90,7 @@ export const apiWithDialog = (<E extends keyof Misskey.Endpoints = keyof Misskey
89
90
} ) ;
90
91
91
92
return promise ;
92
- } ) as typeof misskeyApi ;
93
+ } ) ;
93
94
94
95
export function promiseDialog < T extends Promise < any > > (
95
96
promise : T ,
Original file line number Diff line number Diff line change @@ -206,6 +206,11 @@ function save() {
206
206
lang: profile.lang || null,
207
207
isBot: !!profile.isBot,
208
208
isCat: !!profile.isCat,
209
+ }, undefined, {
210
+ 'SCREEN_NAME_CONTAINS_PROHIBITED_WORDS': {
211
+ title: i18n.ts.screenNameContainsProhibitedWords,
212
+ text: i18n.ts.screenNameContainsProhibitedWordsDescription,
213
+ },
209
214
});
210
215
globalEvents.emit('requestClearPageCache');
211
216
claimAchievement('profileFilled');
You can’t perform that action at this time.
0 commit comments