use injected meta in stream bubble-timeline
This commit is contained in:
parent
7b7bc8b7b3
commit
9200d35f57
@ -4,8 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import type { MiMeta } from '@/models/_.js';
|
||||||
import type { Packed } from '@/misc/json-schema.js';
|
import type { Packed } from '@/misc/json-schema.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
|
||||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { RoleService } from '@/core/RoleService.js';
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
@ -21,10 +22,11 @@ class BubbleTimelineChannel extends Channel {
|
|||||||
private withRenotes: boolean;
|
private withRenotes: boolean;
|
||||||
private withFiles: boolean;
|
private withFiles: boolean;
|
||||||
private withBots: boolean;
|
private withBots: boolean;
|
||||||
private instance: MiMeta;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private metaService: MetaService,
|
@Inject(DI.meta)
|
||||||
|
private serverSettings: MiMeta,
|
||||||
|
|
||||||
private roleService: RoleService,
|
private roleService: RoleService,
|
||||||
private noteEntityService: NoteEntityService,
|
private noteEntityService: NoteEntityService,
|
||||||
|
|
||||||
@ -43,7 +45,6 @@ class BubbleTimelineChannel extends Channel {
|
|||||||
this.withRenotes = !!(params.withRenotes ?? true);
|
this.withRenotes = !!(params.withRenotes ?? true);
|
||||||
this.withFiles = !!(params.withFiles ?? false);
|
this.withFiles = !!(params.withFiles ?? false);
|
||||||
this.withBots = !!(params.withBots ?? true);
|
this.withBots = !!(params.withBots ?? true);
|
||||||
this.instance = await this.metaService.fetch();
|
|
||||||
|
|
||||||
// Subscribe events
|
// Subscribe events
|
||||||
this.subscriber.on('notesStream', this.onNote);
|
this.subscriber.on('notesStream', this.onNote);
|
||||||
@ -54,7 +55,7 @@ class BubbleTimelineChannel extends Channel {
|
|||||||
if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
|
if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
|
||||||
if (!this.withBots && note.user.isBot) return;
|
if (!this.withBots && note.user.isBot) return;
|
||||||
|
|
||||||
if (!(note.user.host != null && this.instance.bubbleInstances.includes(note.user.host) && note.visibility === 'public' )) return;
|
if (!(note.user.host != null && this.serverSettings.bubbleInstances.includes(note.user.host) && note.visibility === 'public' )) return;
|
||||||
|
|
||||||
if (note.channelId != null) return;
|
if (note.channelId != null) return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user