summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/stream/channels/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/server/api/stream/channels/main.ts')
-rw-r--r--packages/backend/src/server/api/stream/channels/main.ts37
1 files changed, 9 insertions, 28 deletions
diff --git a/packages/backend/src/server/api/stream/channels/main.ts b/packages/backend/src/server/api/stream/channels/main.ts
index 525f24c105..2ce53ac288 100644
--- a/packages/backend/src/server/api/stream/channels/main.ts
+++ b/packages/backend/src/server/api/stream/channels/main.ts
@@ -3,26 +3,28 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { Injectable } from '@nestjs/common';
+import { Inject, Injectable, Scope } from '@nestjs/common';
import { isInstanceMuted, isUserFromMutedInstance } from '@/misc/is-instance-muted.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { bindThis } from '@/decorators.js';
import type { JsonObject } from '@/misc/json-value.js';
-import Channel, { type MiChannelService } from '../channel.js';
+import Channel, { type ChannelRequest } from '../channel.js';
+import { REQUEST } from '@nestjs/core';
-class MainChannel extends Channel {
+@Injectable({ scope: Scope.TRANSIENT })
+export class MainChannel extends Channel {
public readonly chName = 'main';
public static shouldShare = true;
public static requireCredential = true as const;
public static kind = 'read:account';
constructor(
- private noteEntityService: NoteEntityService,
+ @Inject(REQUEST)
+ request: ChannelRequest,
- id: string,
- connection: Channel['connection'],
+ private noteEntityService: NoteEntityService,
) {
- super(id, connection);
+ super(request);
}
@bindThis
@@ -61,24 +63,3 @@ class MainChannel extends Channel {
});
}
}
-
-@Injectable()
-export class MainChannelService implements MiChannelService<true> {
- public readonly shouldShare = MainChannel.shouldShare;
- public readonly requireCredential = MainChannel.requireCredential;
- public readonly kind = MainChannel.kind;
-
- constructor(
- private noteEntityService: NoteEntityService,
- ) {
- }
-
- @bindThis
- public create(id: string, connection: Channel['connection']): MainChannel {
- return new MainChannel(
- this.noteEntityService,
- id,
- connection,
- );
- }
-}