merge: Fix note visibility in streaming API (!922)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/922 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
@@ -128,7 +128,7 @@ export class NoteEntityService implements OnModuleInit {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
private async hideNote(packedNote: Packed<'Note'>, meId: MiUser['id'] | null): Promise<void> {
|
||||
public async hideNote(packedNote: Packed<'Note'>, meId: MiUser['id'] | null): Promise<void> {
|
||||
if (meId === packedNote.userId) return;
|
||||
|
||||
// TODO: isVisibleForMe を使うようにしても良さそう(型違うけど)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isInstanceMuted } from '@/misc/is-instance-muted.js';
|
||||
import { isUserRelated } from '@/misc/is-user-related.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import { isRenotePacked, isQuotePacked, isPackedPureRenote } from '@/misc/is-renote.js';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import type { JsonObject, JsonValue } from '@/misc/json-value.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
@@ -17,6 +17,7 @@ import type Connection from './Connection.js';
|
||||
*/
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default abstract class Channel {
|
||||
protected readonly noteEntityService: NoteEntityService;
|
||||
protected connection: Connection;
|
||||
public id: string;
|
||||
public abstract readonly chName: string;
|
||||
@@ -75,12 +76,29 @@ export default abstract class Channel {
|
||||
// 流れてきたNoteがリノートをミュートしてるユーザが行ったもの
|
||||
if (isRenotePacked(note) && !isQuotePacked(note) && this.userIdsWhoMeMutingRenotes.has(note.user.id)) return true;
|
||||
|
||||
// If it's a boost (pure renote) then we need to check the target as well
|
||||
if (isPackedPureRenote(note) && note.renote && this.isNoteMutedOrBlocked(note.renote)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
constructor(id: string, connection: Connection) {
|
||||
protected async hideNote(note: Packed<'Note'>): Promise<void> {
|
||||
if (note.renote) {
|
||||
await this.hideNote(note.renote);
|
||||
}
|
||||
|
||||
if (note.reply) {
|
||||
await this.hideNote(note.reply);
|
||||
}
|
||||
|
||||
const meId = this.user?.id ?? null;
|
||||
await this.noteEntityService.hideNote(note, meId);
|
||||
}
|
||||
|
||||
constructor(id: string, connection: Connection, noteEntityService: NoteEntityService) {
|
||||
this.id = id;
|
||||
this.connection = connection;
|
||||
this.noteEntityService = noteEntityService;
|
||||
}
|
||||
|
||||
public send(payload: { type: string, body: JsonValue }): void
|
||||
@@ -103,7 +121,7 @@ export default abstract class Channel {
|
||||
|
||||
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;
|
||||
// StreamingApiServerService creates a single EventEmitter per server process,
|
||||
// so a new note arriving from redis gets de-serialised once per server process,
|
||||
@@ -113,7 +131,7 @@ export default abstract class Channel {
|
||||
const clonedNote = { ...note };
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
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) {
|
||||
changed = true;
|
||||
clonedNote.renote = { ...note.renote };
|
||||
@@ -121,7 +139,7 @@ export default abstract class Channel {
|
||||
}
|
||||
}
|
||||
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) {
|
||||
changed = true;
|
||||
clonedNote.renote = { ...note.renote };
|
||||
@@ -131,7 +149,7 @@ export default abstract class Channel {
|
||||
}
|
||||
}
|
||||
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) {
|
||||
changed = true;
|
||||
clonedNote.reply = { ...note.reply };
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
class AdminChannel extends Channel {
|
||||
@@ -30,6 +31,7 @@ export class AdminChannelService implements MiChannelService<true> {
|
||||
public readonly kind = AdminChannel.kind;
|
||||
|
||||
constructor(
|
||||
private readonly noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -38,6 +40,7 @@ export class AdminChannelService implements MiChannelService<true> {
|
||||
return new AdminChannel(
|
||||
id,
|
||||
connection,
|
||||
this.noteEntityService,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ class AntennaChannel extends Channel {
|
||||
private antennaId: string;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onEvent = this.onEvent.bind(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ class BubbleTimelineChannel extends Channel {
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
@@ -63,7 +63,8 @@ class BubbleTimelineChannel extends Channel {
|
||||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
await this.hideNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { Injectable } from '@nestjs/common';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
@@ -20,12 +19,12 @@ class ChannelChannel extends Channel {
|
||||
private withRenotes: boolean;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -50,16 +49,12 @@ class ChannelChannel extends Channel {
|
||||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
}
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
await this.hideNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
class DriveChannel extends Channel {
|
||||
@@ -30,6 +31,7 @@ export class DriveChannelService implements MiChannelService<true> {
|
||||
public readonly kind = DriveChannel.kind;
|
||||
|
||||
constructor(
|
||||
private readonly noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -38,6 +40,7 @@ export class DriveChannelService implements MiChannelService<true> {
|
||||
return new DriveChannel(
|
||||
id,
|
||||
connection,
|
||||
this.noteEntityService,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ class GlobalTimelineChannel extends Channel {
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ class GlobalTimelineChannel extends Channel {
|
||||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
await this.hideNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
@@ -19,12 +18,12 @@ class HashtagChannel extends Channel {
|
||||
private q: string[][];
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -46,16 +45,12 @@ class HashtagChannel extends Channel {
|
||||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
}
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
await this.hideNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
||||
@@ -20,12 +20,12 @@ class HomeTimelineChannel extends Channel {
|
||||
private withFiles: boolean;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ class HomeTimelineChannel extends Channel {
|
||||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
await this.hideNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ class HybridTimelineChannel extends Channel {
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,8 @@ class HybridTimelineChannel extends Channel {
|
||||
}
|
||||
}
|
||||
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
await this.hideNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ class LocalTimelineChannel extends Channel {
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
private roleService: RoleService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,8 @@ class LocalTimelineChannel extends Channel {
|
||||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
const clonedNote = await this.assignMyReaction(note, this.noteEntityService);
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
await this.hideNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ class MainChannel extends Channel {
|
||||
public static kind = 'read:account';
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Injectable } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isJsonObject } 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';
|
||||
|
||||
const ev = new Xev();
|
||||
@@ -17,8 +18,8 @@ class QueueStatsChannel extends Channel {
|
||||
public static shouldShare = true;
|
||||
public static requireCredential = false as const;
|
||||
|
||||
constructor(id: string, connection: Channel['connection']) {
|
||||
super(id, connection);
|
||||
constructor(id: string, connection: Channel['connection'], noteEntityService: NoteEntityService) {
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onStats = this.onStats.bind(this);
|
||||
//this.onMessage = this.onMessage.bind(this);
|
||||
}
|
||||
@@ -64,6 +65,7 @@ export class QueueStatsChannelService implements MiChannelService<false> {
|
||||
public readonly kind = QueueStatsChannel.kind;
|
||||
|
||||
constructor(
|
||||
private readonly noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -72,6 +74,7 @@ export class QueueStatsChannelService implements MiChannelService<false> {
|
||||
return new QueueStatsChannel(
|
||||
id,
|
||||
connection,
|
||||
this.noteEntityService,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ReversiService } from '@/core/ReversiService.js';
|
||||
import { ReversiGameEntityService } from '@/core/entities/ReversiGameEntityService.js';
|
||||
import { isJsonObject } 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 { reversiUpdateKeys } from 'misskey-js';
|
||||
|
||||
@@ -23,11 +24,12 @@ class ReversiGameChannel extends Channel {
|
||||
constructor(
|
||||
private reversiService: ReversiService,
|
||||
private reversiGameEntityService: ReversiGameEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
@@ -116,6 +118,7 @@ export class ReversiGameChannelService implements MiChannelService<false> {
|
||||
constructor(
|
||||
private reversiService: ReversiService,
|
||||
private reversiGameEntityService: ReversiGameEntityService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -124,6 +127,7 @@ export class ReversiGameChannelService implements MiChannelService<false> {
|
||||
return new ReversiGameChannel(
|
||||
this.reversiService,
|
||||
this.reversiGameEntityService,
|
||||
this.noteEntityService,
|
||||
id,
|
||||
connection,
|
||||
);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import type { JsonObject } from '@/misc/json-value.js';
|
||||
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||
import Channel, { type MiChannelService } from '../channel.js';
|
||||
|
||||
class ReversiChannel extends Channel {
|
||||
@@ -17,8 +18,9 @@ class ReversiChannel extends Channel {
|
||||
constructor(
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
noteEntityService: NoteEntityService,
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
@@ -40,6 +42,7 @@ export class ReversiChannelService implements MiChannelService<true> {
|
||||
public readonly kind = ReversiChannel.kind;
|
||||
|
||||
constructor(
|
||||
private readonly noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -48,6 +51,7 @@ export class ReversiChannelService implements MiChannelService<true> {
|
||||
return new ReversiChannel(
|
||||
id,
|
||||
connection,
|
||||
this.noteEntityService,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ class RoleTimelineChannel extends Channel {
|
||||
private roleId: string;
|
||||
|
||||
constructor(
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
private roleservice: RoleService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,12 @@ class RoleTimelineChannel extends Channel {
|
||||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
this.send('note', note);
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
await this.hideNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.send('note', clonedNote);
|
||||
} else {
|
||||
this.send(data.type, data.body);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Injectable } from '@nestjs/common';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { isJsonObject } 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';
|
||||
|
||||
const ev = new Xev();
|
||||
@@ -17,8 +18,8 @@ class ServerStatsChannel extends Channel {
|
||||
public static shouldShare = true;
|
||||
public static requireCredential = false as const;
|
||||
|
||||
constructor(id: string, connection: Channel['connection']) {
|
||||
super(id, connection);
|
||||
constructor(id: string, connection: Channel['connection'], noteEntityService: NoteEntityService) {
|
||||
super(id, connection, noteEntityService);
|
||||
//this.onStats = this.onStats.bind(this);
|
||||
//this.onMessage = this.onMessage.bind(this);
|
||||
}
|
||||
@@ -62,6 +63,7 @@ export class ServerStatsChannelService implements MiChannelService<false> {
|
||||
public readonly kind = ServerStatsChannel.kind;
|
||||
|
||||
constructor(
|
||||
private readonly noteEntityService: NoteEntityService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -70,6 +72,7 @@ export class ServerStatsChannelService implements MiChannelService<false> {
|
||||
return new ServerStatsChannel(
|
||||
id,
|
||||
connection,
|
||||
this.noteEntityService,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ class UserListChannel extends Channel {
|
||||
constructor(
|
||||
private userListsRepository: UserListsRepository,
|
||||
private userListMembershipsRepository: UserListMembershipsRepository,
|
||||
private noteEntityService: NoteEntityService,
|
||||
noteEntityService: NoteEntityService,
|
||||
|
||||
id: string,
|
||||
connection: Channel['connection'],
|
||||
) {
|
||||
super(id, connection);
|
||||
super(id, connection, noteEntityService);
|
||||
//this.updateListUsers = this.updateListUsers.bind(this);
|
||||
//this.onNote = this.onNote.bind(this);
|
||||
}
|
||||
@@ -111,16 +111,12 @@ class UserListChannel extends Channel {
|
||||
|
||||
if (this.isNoteMutedOrBlocked(note)) return;
|
||||
|
||||
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
|
||||
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
|
||||
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
|
||||
note.renote.myReaction = myRenoteReaction;
|
||||
}
|
||||
}
|
||||
const clonedNote = await this.assignMyReaction(note);
|
||||
await this.hideNote(clonedNote);
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
this.connection.cacheNote(clonedNote);
|
||||
|
||||
this.send('note', note);
|
||||
this.send('note', clonedNote);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
||||
Reference in New Issue
Block a user