diff --git a/packages/backend/src/core/ReversiService.ts b/packages/backend/src/core/ReversiService.ts index 126b211066..adaf3fbaff 100644 --- a/packages/backend/src/core/ReversiService.ts +++ b/packages/backend/src/core/ReversiService.ts @@ -93,10 +93,6 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit { childId: me.id, }); - if (other === 0) { - publishMainStream(me.id, 'reversiNoInvites'); - } - return game; } else { const child = targetUser; @@ -113,7 +109,6 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit { const packed = await this.reversiMatchingsEntityService.pack(matching, child); this.globalEventService.publishReversiStream(child.id, 'invited', { game: packed }); - publishMainStream(child.id, 'reversiInvited', packed); return null; } diff --git a/packages/backend/src/server/api/stream/channels/reversi.ts b/packages/backend/src/server/api/stream/channels/reversi.ts index eea9ba17c8..cb4b1b8d5a 100644 --- a/packages/backend/src/server/api/stream/channels/reversi.ts +++ b/packages/backend/src/server/api/stream/channels/reversi.ts @@ -3,13 +3,8 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { Inject, Injectable } from '@nestjs/common'; -import * as CRC32 from 'crc-32'; -import type { MiReversiGame, MiUser, ReversiGamesRepository } from '@/models/_.js'; -import type { Packed } from '@/misc/json-schema.js'; -import { DI } from '@/di-symbols.js'; +import { Injectable } from '@nestjs/common'; import { bindThis } from '@/decorators.js'; -import { ReversiService } from '@/core/ReversiService.js'; import Channel, { type MiChannelService } from '../channel.js'; class ReversiChannel extends Channel { @@ -19,9 +14,6 @@ class ReversiChannel extends Channel { public static kind = 'read:account'; constructor( - private reversiService: ReversiService, - private reversiGamesRepository: ReversiGamesRepository, - id: string, connection: Channel['connection'], ) { @@ -30,29 +22,13 @@ class ReversiChannel extends Channel { @bindThis public async init(params: any) { - this.subscriber.on(`reversiStream:${this.user.id}`, this.send); - } - - @bindThis - public async async onMessage(type: string, body: any) { - switch (type) { - case 'ping': { - if (body.id == null) return; - const matching = await ReversiMatchings.findOne({ - parentId: this.user!.id, - childId: body.id, - }); - if (matching == null) return; - publishMainStream(matching.childId, 'reversiInvited', await ReversiMatchings.pack(matching, { id: matching.childId })); - break; - } - } + this.subscriber.on(`reversiStream:${this.user!.id}`, this.send); } @bindThis public dispose() { // Unsubscribe events - this.subscriber.off(`reversiStream:${this.user.id}`, this.send); + this.subscriber.off(`reversiStream:${this.user!.id}`, this.send); } } @@ -63,18 +39,12 @@ export class ReversiChannelService implements MiChannelService { public readonly kind = ReversiChannel.kind; constructor( - @Inject(DI.reversiGamesRepository) - private reversiGamesRepository: ReversiGamesRepository, - - private reversiService: ReversiService, ) { } @bindThis public create(id: string, connection: Channel['connection']): ReversiChannel { return new ReversiChannel( - this.reversiService, - this.reversiGamesRepository, id, connection, );