This commit is contained in:
syuilo 2023-07-31 18:09:28 +09:00
parent baa7022a7d
commit 458f71ab98
3 changed files with 6 additions and 9 deletions

View File

@ -268,7 +268,6 @@ export class ApiCallService implements OnApplicationShutdown {
} }
} }
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if (ep.meta.requireCredential || ep.meta.requireModerator || ep.meta.requireAdmin) { if (ep.meta.requireCredential || ep.meta.requireModerator || ep.meta.requireAdmin) {
if (user == null) { if (user == null) {
throw new ApiError({ throw new ApiError({
@ -298,7 +297,6 @@ export class ApiCallService implements OnApplicationShutdown {
} }
} }
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if ((ep.meta.requireModerator || ep.meta.requireAdmin) && !user!.isRoot) { if ((ep.meta.requireModerator || ep.meta.requireAdmin) && !user!.isRoot) {
const myRoles = await this.roleService.getUserRoles(user!.id); const myRoles = await this.roleService.getUserRoles(user!.id);
if (ep.meta.requireModerator && !myRoles.some(r => r.isModerator || r.isAdministrator)) { if (ep.meta.requireModerator && !myRoles.some(r => r.isModerator || r.isAdministrator)) {
@ -341,7 +339,6 @@ export class ApiCallService implements OnApplicationShutdown {
} }
// Cast non JSON input // Cast non JSON input
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if ((ep.meta.requireFile || request.method === 'GET') && ep.params.properties) { if ((ep.meta.requireFile || request.method === 'GET') && ep.params.properties) {
for (const k of Object.keys(ep.params.properties)) { for (const k of Object.keys(ep.params.properties)) {
const param = ep.params.properties![k]; const param = ep.params.properties![k];

View File

@ -117,13 +117,13 @@ function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Pr
.then(async res => { .then(async res => {
if (res.error) { if (res.error) {
if (res.error.id === 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370') { if (res.error.id === 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370') {
// SUSPENDED // SUSPENDED
if (forceShowDialog || $i && (token === $i.token || id === $i.id)) { if (forceShowDialog || $i && (token === $i.token || id === $i.id)) {
await showSuspendedDialog(); await showSuspendedDialog();
} }
} else if (res.error.id === 'e5b3b9f0-2b8f-4b9f-9c1f-8c5c1b2e1b1a') { } else if (res.error.id === 'e5b3b9f0-2b8f-4b9f-9c1f-8c5c1b2e1b1a') {
// USER_IS_DELETED // USER_IS_DELETED
// アカウントが削除されている // アカウントが削除されている
if (forceShowDialog || $i && (token === $i.token || id === $i.id)) { if (forceShowDialog || $i && (token === $i.token || id === $i.id)) {
await alert({ await alert({
type: 'error', type: 'error',
@ -132,8 +132,8 @@ function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Pr
}); });
} }
} else if (res.error.id === 'b0a7f5f8-dc2f-4171-b91f-de88ad238e14') { } else if (res.error.id === 'b0a7f5f8-dc2f-4171-b91f-de88ad238e14') {
// AUTHENTICATION_FAILED // AUTHENTICATION_FAILED
// トークンが無効化されていたりアカウントが削除されたりしている // トークンが無効化されていたりアカウントが削除されたりしている
if (forceShowDialog || $i && (token === $i.token || id === $i.id)) { if (forceShowDialog || $i && (token === $i.token || id === $i.id)) {
await alert({ await alert({
type: 'error', type: 'error',

View File

@ -77,7 +77,7 @@ module.exports = {
}], }],
'@typescript-eslint/consistent-type-imports': 'off', '@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/prefer-nullish-coalescing': [ '@typescript-eslint/prefer-nullish-coalescing': [
'error', 'warn',
], ],
'@typescript-eslint/naming-convention': [ '@typescript-eslint/naming-convention': [
'error', 'error',