mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 15:34:13 +00:00 
			
		
		
		
	pass NoteEntityService through Channel constructor instead of method args
This commit is contained in:
		
							parent
							
								
									de3c9124cd
								
							
						
					
					
						commit
						019e60d9a4
					
				
					 18 changed files with 60 additions and 37 deletions
				
			
		| 
						 | 
					@ -17,6 +17,7 @@ import type Connection from './Connection.js';
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
// eslint-disable-next-line import/no-default-export
 | 
					// eslint-disable-next-line import/no-default-export
 | 
				
			||||||
export default abstract class Channel {
 | 
					export default abstract class Channel {
 | 
				
			||||||
 | 
						protected readonly noteEntityService: NoteEntityService;
 | 
				
			||||||
	protected connection: Connection;
 | 
						protected connection: Connection;
 | 
				
			||||||
	public id: string;
 | 
						public id: string;
 | 
				
			||||||
	public abstract readonly chName: string;
 | 
						public abstract readonly chName: string;
 | 
				
			||||||
| 
						 | 
					@ -82,8 +83,10 @@ export default abstract class Channel {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(id: string, connection: Connection) {
 | 
						constructor(id: string, connection: Connection) {
 | 
				
			||||||
 | 
						constructor(id: string, connection: Connection, noteEntityService: NoteEntityService) {
 | 
				
			||||||
		this.id = id;
 | 
							this.id = id;
 | 
				
			||||||
		this.connection = connection;
 | 
							this.connection = connection;
 | 
				
			||||||
 | 
							this.noteEntityService = noteEntityService;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public send(payload: { type: string, body: JsonValue }): void
 | 
						public send(payload: { type: string, body: JsonValue }): void
 | 
				
			||||||
| 
						 | 
					@ -106,7 +109,7 @@ export default abstract class Channel {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public onMessage?(type: string, body: JsonValue): void;
 | 
						public onMessage?(type: string, body: JsonValue): void;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public async assignMyReaction(note: Packed<'Note'>, noteEntityService: NoteEntityService): Promise<Packed<'Note'>> {
 | 
						public async assignMyReaction(note: Packed<'Note'>): Promise<Packed<'Note'>> {
 | 
				
			||||||
		let changed = false;
 | 
							let changed = false;
 | 
				
			||||||
		// StreamingApiServerService creates a single EventEmitter per server process,
 | 
							// StreamingApiServerService creates a single EventEmitter per server process,
 | 
				
			||||||
		// so a new note arriving from redis gets de-serialised once per server process,
 | 
							// so a new note arriving from redis gets de-serialised once per server process,
 | 
				
			||||||
| 
						 | 
					@ -116,7 +119,7 @@ export default abstract class Channel {
 | 
				
			||||||
		const clonedNote = { ...note };
 | 
							const clonedNote = { ...note };
 | 
				
			||||||
		if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
 | 
							if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
 | 
				
			||||||
			if (note.renote && Object.keys(note.renote.reactions).length > 0) {
 | 
								if (note.renote && Object.keys(note.renote.reactions).length > 0) {
 | 
				
			||||||
				const myReaction = await noteEntityService.populateMyReaction(note.renote, this.user.id);
 | 
									const myReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
 | 
				
			||||||
				if (myReaction) {
 | 
									if (myReaction) {
 | 
				
			||||||
					changed = true;
 | 
										changed = true;
 | 
				
			||||||
					clonedNote.renote = { ...note.renote };
 | 
										clonedNote.renote = { ...note.renote };
 | 
				
			||||||
| 
						 | 
					@ -124,7 +127,7 @@ export default abstract class Channel {
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (note.renote?.reply && Object.keys(note.renote.reply.reactions).length > 0) {
 | 
								if (note.renote?.reply && Object.keys(note.renote.reply.reactions).length > 0) {
 | 
				
			||||||
				const myReaction = await noteEntityService.populateMyReaction(note.renote.reply, this.user.id);
 | 
									const myReaction = await this.noteEntityService.populateMyReaction(note.renote.reply, this.user.id);
 | 
				
			||||||
				if (myReaction) {
 | 
									if (myReaction) {
 | 
				
			||||||
					changed = true;
 | 
										changed = true;
 | 
				
			||||||
					clonedNote.renote = { ...note.renote };
 | 
										clonedNote.renote = { ...note.renote };
 | 
				
			||||||
| 
						 | 
					@ -134,7 +137,7 @@ export default abstract class Channel {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (this.user && note.reply && Object.keys(note.reply.reactions).length > 0) {
 | 
							if (this.user && note.reply && Object.keys(note.reply.reactions).length > 0) {
 | 
				
			||||||
			const myReaction = await noteEntityService.populateMyReaction(note.reply, this.user.id);
 | 
								const myReaction = await this.noteEntityService.populateMyReaction(note.reply, this.user.id);
 | 
				
			||||||
			if (myReaction) {
 | 
								if (myReaction) {
 | 
				
			||||||
				changed = true;
 | 
									changed = true;
 | 
				
			||||||
				clonedNote.reply = { ...note.reply };
 | 
									clonedNote.reply = { ...note.reply };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,7 @@
 | 
				
			||||||
import { Injectable } from '@nestjs/common';
 | 
					import { Injectable } from '@nestjs/common';
 | 
				
			||||||
import { bindThis } from '@/decorators.js';
 | 
					import { bindThis } from '@/decorators.js';
 | 
				
			||||||
import type { JsonObject } from '@/misc/json-value.js';
 | 
					import type { JsonObject } from '@/misc/json-value.js';
 | 
				
			||||||
 | 
					import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
 | 
				
			||||||
import Channel, { type MiChannelService } from '../channel.js';
 | 
					import Channel, { type MiChannelService } from '../channel.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class AdminChannel extends Channel {
 | 
					class AdminChannel extends Channel {
 | 
				
			||||||
| 
						 | 
					@ -30,6 +31,7 @@ export class AdminChannelService implements MiChannelService<true> {
 | 
				
			||||||
	public readonly kind = AdminChannel.kind;
 | 
						public readonly kind = AdminChannel.kind;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
 | 
							private readonly noteEntityService: NoteEntityService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,6 +40,7 @@ export class AdminChannelService implements MiChannelService<true> {
 | 
				
			||||||
		return new AdminChannel(
 | 
							return new AdminChannel(
 | 
				
			||||||
			id,
 | 
								id,
 | 
				
			||||||
			connection,
 | 
								connection,
 | 
				
			||||||
 | 
								this.noteEntityService,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,12 +18,12 @@ class AntennaChannel extends Channel {
 | 
				
			||||||
	private antennaId: string;
 | 
						private antennaId: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onEvent = this.onEvent.bind(this);
 | 
							//this.onEvent = this.onEvent.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,12 +26,12 @@ class BubbleTimelineChannel extends Channel {
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private metaService: MetaService,
 | 
							private metaService: MetaService,
 | 
				
			||||||
		private roleService: RoleService,
 | 
							private roleService: RoleService,
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@bindThis
 | 
						@bindThis
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,7 @@ class BubbleTimelineChannel extends Channel {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (this.isNoteMutedOrBlocked(note)) return;
 | 
							if (this.isNoteMutedOrBlocked(note)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
 | 
							const clonedNote = await this.assignMyReaction(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.connection.cacheNote(clonedNote);
 | 
							this.connection.cacheNote(clonedNote);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,12 +20,12 @@ class ChannelChannel extends Channel {
 | 
				
			||||||
	private withRenotes: boolean;
 | 
						private withRenotes: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onNote = this.onNote.bind(this);
 | 
							//this.onNote = this.onNote.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,7 @@
 | 
				
			||||||
import { Injectable } from '@nestjs/common';
 | 
					import { Injectable } from '@nestjs/common';
 | 
				
			||||||
import { bindThis } from '@/decorators.js';
 | 
					import { bindThis } from '@/decorators.js';
 | 
				
			||||||
import type { JsonObject } from '@/misc/json-value.js';
 | 
					import type { JsonObject } from '@/misc/json-value.js';
 | 
				
			||||||
 | 
					import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
 | 
				
			||||||
import Channel, { type MiChannelService } from '../channel.js';
 | 
					import Channel, { type MiChannelService } from '../channel.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DriveChannel extends Channel {
 | 
					class DriveChannel extends Channel {
 | 
				
			||||||
| 
						 | 
					@ -30,6 +31,7 @@ export class DriveChannelService implements MiChannelService<true> {
 | 
				
			||||||
	public readonly kind = DriveChannel.kind;
 | 
						public readonly kind = DriveChannel.kind;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
 | 
							private readonly noteEntityService: NoteEntityService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,6 +40,7 @@ export class DriveChannelService implements MiChannelService<true> {
 | 
				
			||||||
		return new DriveChannel(
 | 
							return new DriveChannel(
 | 
				
			||||||
			id,
 | 
								id,
 | 
				
			||||||
			connection,
 | 
								connection,
 | 
				
			||||||
 | 
								this.noteEntityService,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,12 +24,12 @@ class GlobalTimelineChannel extends Channel {
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private metaService: MetaService,
 | 
							private metaService: MetaService,
 | 
				
			||||||
		private roleService: RoleService,
 | 
							private roleService: RoleService,
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onNote = this.onNote.bind(this);
 | 
							//this.onNote = this.onNote.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,7 +60,7 @@ class GlobalTimelineChannel extends Channel {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (this.isNoteMutedOrBlocked(note)) return;
 | 
							if (this.isNoteMutedOrBlocked(note)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
 | 
							const clonedNote = await this.assignMyReaction(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.connection.cacheNote(clonedNote);
 | 
							this.connection.cacheNote(clonedNote);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,12 +19,12 @@ class HashtagChannel extends Channel {
 | 
				
			||||||
	private q: string[][];
 | 
						private q: string[][];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onNote = this.onNote.bind(this);
 | 
							//this.onNote = this.onNote.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,12 +20,12 @@ class HomeTimelineChannel extends Channel {
 | 
				
			||||||
	private withFiles: boolean;
 | 
						private withFiles: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onNote = this.onNote.bind(this);
 | 
							//this.onNote = this.onNote.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -81,7 +81,7 @@ class HomeTimelineChannel extends Channel {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (this.isNoteMutedOrBlocked(note)) return;
 | 
							if (this.isNoteMutedOrBlocked(note)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
 | 
							const clonedNote = await this.assignMyReaction(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.connection.cacheNote(clonedNote);
 | 
							this.connection.cacheNote(clonedNote);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,12 +26,12 @@ class HybridTimelineChannel extends Channel {
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private metaService: MetaService,
 | 
							private metaService: MetaService,
 | 
				
			||||||
		private roleService: RoleService,
 | 
							private roleService: RoleService,
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onNote = this.onNote.bind(this);
 | 
							//this.onNote = this.onNote.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,7 +98,7 @@ class HybridTimelineChannel extends Channel {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
 | 
							const clonedNote = await this.assignMyReaction(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.connection.cacheNote(clonedNote);
 | 
							this.connection.cacheNote(clonedNote);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,12 +25,12 @@ class LocalTimelineChannel extends Channel {
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private metaService: MetaService,
 | 
							private metaService: MetaService,
 | 
				
			||||||
		private roleService: RoleService,
 | 
							private roleService: RoleService,
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onNote = this.onNote.bind(this);
 | 
							//this.onNote = this.onNote.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,7 +70,7 @@ class LocalTimelineChannel extends Channel {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (this.isNoteMutedOrBlocked(note)) return;
 | 
							if (this.isNoteMutedOrBlocked(note)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
 | 
							const clonedNote = await this.assignMyReaction(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		this.connection.cacheNote(clonedNote);
 | 
							this.connection.cacheNote(clonedNote);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,12 +17,12 @@ class MainChannel extends Channel {
 | 
				
			||||||
	public static kind = 'read:account';
 | 
						public static kind = 'read:account';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@bindThis
 | 
						@bindThis
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import { Injectable } from '@nestjs/common';
 | 
				
			||||||
import { bindThis } from '@/decorators.js';
 | 
					import { bindThis } from '@/decorators.js';
 | 
				
			||||||
import { isJsonObject } from '@/misc/json-value.js';
 | 
					import { isJsonObject } from '@/misc/json-value.js';
 | 
				
			||||||
import type { JsonObject, JsonValue } from '@/misc/json-value.js';
 | 
					import type { JsonObject, JsonValue } from '@/misc/json-value.js';
 | 
				
			||||||
 | 
					import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
 | 
				
			||||||
import Channel, { type MiChannelService } from '../channel.js';
 | 
					import Channel, { type MiChannelService } from '../channel.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ev = new Xev();
 | 
					const ev = new Xev();
 | 
				
			||||||
| 
						 | 
					@ -17,8 +18,8 @@ class QueueStatsChannel extends Channel {
 | 
				
			||||||
	public static shouldShare = true;
 | 
						public static shouldShare = true;
 | 
				
			||||||
	public static requireCredential = false as const;
 | 
						public static requireCredential = false as const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(id: string, connection: Channel['connection']) {
 | 
						constructor(id: string, connection: Channel['connection'], noteEntityService: NoteEntityService) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onStats = this.onStats.bind(this);
 | 
							//this.onStats = this.onStats.bind(this);
 | 
				
			||||||
		//this.onMessage = this.onMessage.bind(this);
 | 
							//this.onMessage = this.onMessage.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -64,6 +65,7 @@ export class QueueStatsChannelService implements MiChannelService<false> {
 | 
				
			||||||
	public readonly kind = QueueStatsChannel.kind;
 | 
						public readonly kind = QueueStatsChannel.kind;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
 | 
							private readonly noteEntityService: NoteEntityService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,6 +74,7 @@ export class QueueStatsChannelService implements MiChannelService<false> {
 | 
				
			||||||
		return new QueueStatsChannel(
 | 
							return new QueueStatsChannel(
 | 
				
			||||||
			id,
 | 
								id,
 | 
				
			||||||
			connection,
 | 
								connection,
 | 
				
			||||||
 | 
								this.noteEntityService,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,7 @@ import { ReversiService } from '@/core/ReversiService.js';
 | 
				
			||||||
import { ReversiGameEntityService } from '@/core/entities/ReversiGameEntityService.js';
 | 
					import { ReversiGameEntityService } from '@/core/entities/ReversiGameEntityService.js';
 | 
				
			||||||
import { isJsonObject } from '@/misc/json-value.js';
 | 
					import { isJsonObject } from '@/misc/json-value.js';
 | 
				
			||||||
import type { JsonObject, JsonValue } from '@/misc/json-value.js';
 | 
					import type { JsonObject, JsonValue } from '@/misc/json-value.js';
 | 
				
			||||||
 | 
					import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
 | 
				
			||||||
import Channel, { type MiChannelService } from '../channel.js';
 | 
					import Channel, { type MiChannelService } from '../channel.js';
 | 
				
			||||||
import { reversiUpdateKeys } from 'misskey-js';
 | 
					import { reversiUpdateKeys } from 'misskey-js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,11 +24,12 @@ class ReversiGameChannel extends Channel {
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private reversiService: ReversiService,
 | 
							private reversiService: ReversiService,
 | 
				
			||||||
		private reversiGameEntityService: ReversiGameEntityService,
 | 
							private reversiGameEntityService: ReversiGameEntityService,
 | 
				
			||||||
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@bindThis
 | 
						@bindThis
 | 
				
			||||||
| 
						 | 
					@ -116,6 +118,7 @@ export class ReversiGameChannelService implements MiChannelService<false> {
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private reversiService: ReversiService,
 | 
							private reversiService: ReversiService,
 | 
				
			||||||
		private reversiGameEntityService: ReversiGameEntityService,
 | 
							private reversiGameEntityService: ReversiGameEntityService,
 | 
				
			||||||
 | 
							private noteEntityService: NoteEntityService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -124,6 +127,7 @@ export class ReversiGameChannelService implements MiChannelService<false> {
 | 
				
			||||||
		return new ReversiGameChannel(
 | 
							return new ReversiGameChannel(
 | 
				
			||||||
			this.reversiService,
 | 
								this.reversiService,
 | 
				
			||||||
			this.reversiGameEntityService,
 | 
								this.reversiGameEntityService,
 | 
				
			||||||
 | 
								this.noteEntityService,
 | 
				
			||||||
			id,
 | 
								id,
 | 
				
			||||||
			connection,
 | 
								connection,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,7 @@
 | 
				
			||||||
import { Injectable } from '@nestjs/common';
 | 
					import { Injectable } from '@nestjs/common';
 | 
				
			||||||
import { bindThis } from '@/decorators.js';
 | 
					import { bindThis } from '@/decorators.js';
 | 
				
			||||||
import type { JsonObject } from '@/misc/json-value.js';
 | 
					import type { JsonObject } from '@/misc/json-value.js';
 | 
				
			||||||
 | 
					import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
 | 
				
			||||||
import Channel, { type MiChannelService } from '../channel.js';
 | 
					import Channel, { type MiChannelService } from '../channel.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ReversiChannel extends Channel {
 | 
					class ReversiChannel extends Channel {
 | 
				
			||||||
| 
						 | 
					@ -17,8 +18,9 @@ class ReversiChannel extends Channel {
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@bindThis
 | 
						@bindThis
 | 
				
			||||||
| 
						 | 
					@ -40,6 +42,7 @@ export class ReversiChannelService implements MiChannelService<true> {
 | 
				
			||||||
	public readonly kind = ReversiChannel.kind;
 | 
						public readonly kind = ReversiChannel.kind;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
 | 
							private readonly noteEntityService: NoteEntityService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,6 +51,7 @@ export class ReversiChannelService implements MiChannelService<true> {
 | 
				
			||||||
		return new ReversiChannel(
 | 
							return new ReversiChannel(
 | 
				
			||||||
			id,
 | 
								id,
 | 
				
			||||||
			connection,
 | 
								connection,
 | 
				
			||||||
 | 
								this.noteEntityService,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,13 +18,13 @@ class RoleTimelineChannel extends Channel {
 | 
				
			||||||
	private roleId: string;
 | 
						private roleId: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
		private roleservice: RoleService,
 | 
							private roleservice: RoleService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onNote = this.onNote.bind(this);
 | 
							//this.onNote = this.onNote.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import { Injectable } from '@nestjs/common';
 | 
				
			||||||
import { bindThis } from '@/decorators.js';
 | 
					import { bindThis } from '@/decorators.js';
 | 
				
			||||||
import { isJsonObject } from '@/misc/json-value.js';
 | 
					import { isJsonObject } from '@/misc/json-value.js';
 | 
				
			||||||
import type { JsonObject, JsonValue } from '@/misc/json-value.js';
 | 
					import type { JsonObject, JsonValue } from '@/misc/json-value.js';
 | 
				
			||||||
 | 
					import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
 | 
				
			||||||
import Channel, { type MiChannelService } from '../channel.js';
 | 
					import Channel, { type MiChannelService } from '../channel.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ev = new Xev();
 | 
					const ev = new Xev();
 | 
				
			||||||
| 
						 | 
					@ -17,8 +18,8 @@ class ServerStatsChannel extends Channel {
 | 
				
			||||||
	public static shouldShare = true;
 | 
						public static shouldShare = true;
 | 
				
			||||||
	public static requireCredential = false as const;
 | 
						public static requireCredential = false as const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(id: string, connection: Channel['connection']) {
 | 
						constructor(id: string, connection: Channel['connection'], noteEntityService: NoteEntityService) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.onStats = this.onStats.bind(this);
 | 
							//this.onStats = this.onStats.bind(this);
 | 
				
			||||||
		//this.onMessage = this.onMessage.bind(this);
 | 
							//this.onMessage = this.onMessage.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -62,6 +63,7 @@ export class ServerStatsChannelService implements MiChannelService<false> {
 | 
				
			||||||
	public readonly kind = ServerStatsChannel.kind;
 | 
						public readonly kind = ServerStatsChannel.kind;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
 | 
							private readonly noteEntityService: NoteEntityService,
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,6 +72,7 @@ export class ServerStatsChannelService implements MiChannelService<false> {
 | 
				
			||||||
		return new ServerStatsChannel(
 | 
							return new ServerStatsChannel(
 | 
				
			||||||
			id,
 | 
								id,
 | 
				
			||||||
			connection,
 | 
								connection,
 | 
				
			||||||
 | 
								this.noteEntityService,
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,12 +26,12 @@ class UserListChannel extends Channel {
 | 
				
			||||||
	constructor(
 | 
						constructor(
 | 
				
			||||||
		private userListsRepository: UserListsRepository,
 | 
							private userListsRepository: UserListsRepository,
 | 
				
			||||||
		private userListMembershipsRepository: UserListMembershipsRepository,
 | 
							private userListMembershipsRepository: UserListMembershipsRepository,
 | 
				
			||||||
		private noteEntityService: NoteEntityService,
 | 
							noteEntityService: NoteEntityService,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		id: string,
 | 
							id: string,
 | 
				
			||||||
		connection: Channel['connection'],
 | 
							connection: Channel['connection'],
 | 
				
			||||||
	) {
 | 
						) {
 | 
				
			||||||
		super(id, connection);
 | 
							super(id, connection, noteEntityService);
 | 
				
			||||||
		//this.updateListUsers = this.updateListUsers.bind(this);
 | 
							//this.updateListUsers = this.updateListUsers.bind(this);
 | 
				
			||||||
		//this.onNote = this.onNote.bind(this);
 | 
							//this.onNote = this.onNote.bind(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue