summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/stream/channels/chat-user.ts
diff options
context:
space:
mode:
authoranatawa12 <anatawa12@icloud.com>2025-12-22 17:01:10 +0900
committerGitHub <noreply@github.com>2025-12-22 17:01:10 +0900
commit74e847a04d1b287f50a10f7c1e44a4e7bc2f91ac (patch)
treef50e8a73312f2e01262d66c4d034ad5c0df52304 /packages/backend/src/server/api/stream/channels/chat-user.ts
parentfeat: use tsgo where capable (#16984) (diff)
downloadmisskey-74e847a04d1b287f50a10f7c1e44a4e7bc2f91ac.tar.gz
misskey-74e847a04d1b287f50a10f7c1e44a4e7bc2f91ac.tar.bz2
misskey-74e847a04d1b287f50a10f7c1e44a4e7bc2f91ac.zip
refactor: use TRANSIENT scope to avoid service bucket relay (#16985)
* refactor: use TRANSIENT scope to avoid service bucket relay * lint: fix lints * refactor: use transient for apResolver * Update packages/backend/src/core/activitypub/models/ApImageService.ts * fix
Diffstat (limited to 'packages/backend/src/server/api/stream/channels/chat-user.ts')
-rw-r--r--packages/backend/src/server/api/stream/channels/chat-user.ts37
1 files changed, 9 insertions, 28 deletions
diff --git a/packages/backend/src/server/api/stream/channels/chat-user.ts b/packages/backend/src/server/api/stream/channels/chat-user.ts
index 5323484ed7..36f3f67b28 100644
--- a/packages/backend/src/server/api/stream/channels/chat-user.ts
+++ b/packages/backend/src/server/api/stream/channels/chat-user.ts
@@ -3,14 +3,16 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { Injectable } from '@nestjs/common';
+import { Inject, Injectable, Scope } from '@nestjs/common';
import { bindThis } from '@/decorators.js';
import type { GlobalEvents } from '@/core/GlobalEventService.js';
import type { JsonObject } from '@/misc/json-value.js';
import { ChatService } from '@/core/ChatService.js';
-import Channel, { type MiChannelService } from '../channel.js';
+import Channel, { type ChannelRequest } from '../channel.js';
+import { REQUEST } from '@nestjs/core';
-class ChatUserChannel extends Channel {
+@Injectable({ scope: Scope.TRANSIENT })
+export class ChatUserChannel extends Channel {
public readonly chName = 'chatUser';
public static shouldShare = false;
public static requireCredential = true as const;
@@ -18,12 +20,12 @@ class ChatUserChannel extends Channel {
private otherId: string;
constructor(
- private chatService: ChatService,
+ @Inject(REQUEST)
+ request: ChannelRequest,
- id: string,
- connection: Channel['connection'],
+ private chatService: ChatService,
) {
- super(id, connection);
+ super(request);
}
@bindThis
@@ -55,24 +57,3 @@ class ChatUserChannel extends Channel {
this.subscriber.off(`chatUserStream:${this.user!.id}-${this.otherId}`, this.onEvent);
}
}
-
-@Injectable()
-export class ChatUserChannelService implements MiChannelService<true> {
- public readonly shouldShare = ChatUserChannel.shouldShare;
- public readonly requireCredential = ChatUserChannel.requireCredential;
- public readonly kind = ChatUserChannel.kind;
-
- constructor(
- private chatService: ChatService,
- ) {
- }
-
- @bindThis
- public create(id: string, connection: Channel['connection']): ChatUserChannel {
- return new ChatUserChannel(
- this.chatService,
- id,
- connection,
- );
- }
-}