From d8d2188b4dec630ea5a315fc59106b639ae58cab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BE=E3=81=A3=E3=81=A1=E3=82=83=E3=81=A8=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=82=85?= <17376330+u1-liquid@users.noreply.github.com> Date: Tue, 23 Jan 2024 06:16:10 +0900 Subject: [PATCH] fix code quality issues --- packages/backend/src/core/ReversiService.ts | 13 ++----------- .../src/core/entities/ReversiGameEntityService.ts | 8 ++++---- .../server/api/endpoints/reversi/cancel-match.ts | 1 - .../src/server/api/endpoints/reversi/invitations.ts | 3 +-- .../src/server/api/stream/channels/reversi.ts | 11 ----------- packages/frontend/src/components/MkTimeline.vue | 2 +- .../frontend/src/pages/reversi/game.setting.vue | 2 +- packages/frontend/src/pages/reversi/game.vue | 2 +- packages/misskey-bubble-game/src/game.ts | 2 +- packages/misskey-js/src/entities.ts | 2 +- 10 files changed, 12 insertions(+), 34 deletions(-) diff --git a/packages/backend/src/core/ReversiService.ts b/packages/backend/src/core/ReversiService.ts index 439d0f922d..3cafbc6170 100644 --- a/packages/backend/src/core/ReversiService.ts +++ b/packages/backend/src/core/ReversiService.ts @@ -22,12 +22,12 @@ import { IdService } from '@/core/IdService.js'; import { NotificationService } from '@/core/NotificationService.js'; import { Serialized } from '@/types.js'; import { ReversiGameEntityService } from './entities/ReversiGameEntityService.js'; -import type { OnApplicationShutdown, OnModuleInit } from '@nestjs/common'; +import type { OnModuleInit } from '@nestjs/common'; const MATCHING_TIMEOUT_MS = 1000 * 15; // 15sec @Injectable() -export class ReversiService implements OnApplicationShutdown, OnModuleInit { +export class ReversiService implements OnModuleInit { private notificationService: NotificationService; constructor( @@ -543,13 +543,4 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit { return null; } } - - @bindThis - public dispose(): void { - } - - @bindThis - public onApplicationShutdown(signal?: string | undefined): void { - this.dispose(); - } } diff --git a/packages/backend/src/core/entities/ReversiGameEntityService.ts b/packages/backend/src/core/entities/ReversiGameEntityService.ts index 9045ca02fc..6f90b8d690 100644 --- a/packages/backend/src/core/entities/ReversiGameEntityService.ts +++ b/packages/backend/src/core/entities/ReversiGameEntityService.ts @@ -38,8 +38,8 @@ export class ReversiGameEntityService { return await awaitAll({ id: game.id, createdAt: game.createdAt.toISOString(), - startedAt: game.startedAt && game.startedAt.toISOString(), - endedAt: game.endedAt && game.endedAt.toISOString(), + startedAt: game.startedAt?.toISOString() ?? null, + endedAt: game.endedAt?.toISOString() ?? null, isStarted: game.isStarted, isEnded: game.isEnded, form1: game.form1, @@ -90,8 +90,8 @@ export class ReversiGameEntityService { return await awaitAll({ id: game.id, createdAt: game.createdAt.toISOString(), - startedAt: game.startedAt && game.startedAt.toISOString(), - endedAt: game.endedAt && game.endedAt.toISOString(), + startedAt: game.startedAt?.toISOString() ?? null, + endedAt: game.endedAt?.toISOString() ?? null, isStarted: game.isStarted, isEnded: game.isEnded, user1Id: game.user1Id, diff --git a/packages/backend/src/server/api/endpoints/reversi/cancel-match.ts b/packages/backend/src/server/api/endpoints/reversi/cancel-match.ts index e15a855deb..5822d3a963 100644 --- a/packages/backend/src/server/api/endpoints/reversi/cancel-match.ts +++ b/packages/backend/src/server/api/endpoints/reversi/cancel-match.ts @@ -35,7 +35,6 @@ export default class extends Endpoint { // eslint- super(meta, paramDef, async (ps, me) => { if (ps.userId) { await this.reversiService.matchSpecificUserCancel(me, ps.userId); - return; } else { await this.reversiService.matchAnyUserCancel(me); } diff --git a/packages/backend/src/server/api/endpoints/reversi/invitations.ts b/packages/backend/src/server/api/endpoints/reversi/invitations.ts index 0b7107bb0d..b468f89997 100644 --- a/packages/backend/src/server/api/endpoints/reversi/invitations.ts +++ b/packages/backend/src/server/api/endpoints/reversi/invitations.ts @@ -3,9 +3,8 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { Inject, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; -import { DI } from '@/di-symbols.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { ReversiService } from '@/core/ReversiService.js'; diff --git a/packages/backend/src/server/api/stream/channels/reversi.ts b/packages/backend/src/server/api/stream/channels/reversi.ts index cb4b1b8d5a..4ea9784ba5 100644 --- a/packages/backend/src/server/api/stream/channels/reversi.ts +++ b/packages/backend/src/server/api/stream/channels/reversi.ts @@ -13,13 +13,6 @@ class ReversiChannel extends Channel { public static requireCredential = true as const; public static kind = 'read:account'; - constructor( - id: string, - connection: Channel['connection'], - ) { - super(id, connection); - } - @bindThis public async init(params: any) { this.subscriber.on(`reversiStream:${this.user!.id}`, this.send); @@ -38,10 +31,6 @@ export class ReversiChannelService implements MiChannelService { public readonly requireCredential = ReversiChannel.requireCredential; public readonly kind = ReversiChannel.kind; - constructor( - ) { - } - @bindThis public create(id: string, connection: Channel['connection']): ReversiChannel { return new ReversiChannel( diff --git a/packages/frontend/src/components/MkTimeline.vue b/packages/frontend/src/components/MkTimeline.vue index 893735a996..1bb3952640 100644 --- a/packages/frontend/src/components/MkTimeline.vue +++ b/packages/frontend/src/components/MkTimeline.vue @@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only