summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranatawa12 <anatawa12@icloud.com>2024-04-17 14:23:41 +0900
committerGitHub <noreply@github.com>2024-04-17 14:23:41 +0900
commite423b8ce4b28ecbe4e300fc67389e4def3761eb6 (patch)
tree43d5e15ead542d1f0dad7dc30e0f86dc7e192535
parentenhance(frontend): フォローするかどうかの確認ダイアログを... (diff)
downloadsharkey-e423b8ce4b28ecbe4e300fc67389e4def3761eb6.tar.gz
sharkey-e423b8ce4b28ecbe4e300fc67389e4def3761eb6.tar.bz2
sharkey-e423b8ce4b28ecbe4e300fc67389e4def3761eb6.zip
細かいミュートの処理の修正 (#13695)
* fix: some replies are removed from global timeline * refactor: 各チャンネルのミュートとブロックの処理をまとめる * fix: リノートをミュートでその人のノートのリノートをミュートしていたを修正 * refactor: isPureRenotePackedを他のところでも使う * docs(changelog): CHANGELOGを更新 * test: withReplies = falseでフォローしてる人によるリプライが流れてくる * test: ノートミュートしているユーザーの通常ノートのリノートが流れてくる/含まれる
-rw-r--r--CHANGELOG.md3
-rw-r--r--packages/backend/src/core/FanoutTimelineEndpointService.ts2
-rw-r--r--packages/backend/src/misc/is-renote.ts31
-rw-r--r--packages/backend/src/server/api/stream/channel.ts22
-rw-r--r--packages/backend/src/server/api/stream/channels/antenna.ts8
-rw-r--r--packages/backend/src/server/api/stream/channels/channel.ts11
-rw-r--r--packages/backend/src/server/api/stream/channels/global-timeline.ts25
-rw-r--r--packages/backend/src/server/api/stream/channels/hashtag.ts11
-rw-r--r--packages/backend/src/server/api/stream/channels/home-timeline.ts18
-rw-r--r--packages/backend/src/server/api/stream/channels/hybrid-timeline.ts16
-rw-r--r--packages/backend/src/server/api/stream/channels/local-timeline.ts14
-rw-r--r--packages/backend/src/server/api/stream/channels/role-timeline.ts9
-rw-r--r--packages/backend/src/server/api/stream/channels/user-list.ts17
-rw-r--r--packages/backend/test/e2e/renote-mute.ts29
-rw-r--r--packages/backend/test/e2e/streaming.ts12
15 files changed, 124 insertions, 104 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d27979d88f..36632e5024 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -55,6 +55,9 @@
- Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606)
- Fix: nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正
+- Fix: 一部のタイムラインのストリーミングでインスタンスミュートが効かない問題を修正
+- Fix: グローバルタイムラインで返信が表示されないことがある問題を修正
+- Fix: リノートをミュートしたユーザの投稿のリノートがミュートされる問題を修正
## 2024.3.1
diff --git a/packages/backend/src/core/FanoutTimelineEndpointService.ts b/packages/backend/src/core/FanoutTimelineEndpointService.ts
index 006433df7a..884723ff81 100644
--- a/packages/backend/src/core/FanoutTimelineEndpointService.ts
+++ b/packages/backend/src/core/FanoutTimelineEndpointService.ts
@@ -116,7 +116,7 @@ export class FanoutTimelineEndpointService {
filter = (note) => {
if (isUserRelated(note, userIdsWhoBlockingMe, ps.ignoreAuthorFromBlock)) return false;
if (isUserRelated(note, userIdsWhoMeMuting, ps.ignoreAuthorFromMute)) return false;
- if (isRenote(note) && !isQuote(note) && isUserRelated(note, userIdsWhoMeMutingRenotes, ps.ignoreAuthorFromMute)) return false;
+ if (!ps.ignoreAuthorFromMute && isRenote(note) && !isQuote(note) && userIdsWhoMeMutingRenotes.has(note.userId)) return false;
if (isInstanceMuted(note, userMutedInstances)) return false;
return parentFilter(note);
diff --git a/packages/backend/src/misc/is-renote.ts b/packages/backend/src/misc/is-renote.ts
index 5d48aba360..48f821806c 100644
--- a/packages/backend/src/misc/is-renote.ts
+++ b/packages/backend/src/misc/is-renote.ts
@@ -4,6 +4,7 @@
*/
import type { MiNote } from '@/models/Note.js';
+import type { Packed } from '@/misc/json-schema.js';
type Renote =
MiNote & {
@@ -34,3 +35,33 @@ export function isQuote(note: Renote): note is Quote {
note.hasPoll ||
note.fileIds.length > 0;
}
+
+type PackedRenote =
+ Packed<'Note'> & {
+ renoteId: NonNullable<Packed<'Note'>['renoteId']>
+ };
+
+type PackedQuote =
+ PackedRenote & ({
+ text: NonNullable<Packed<'Note'>['text']>
+ } | {
+ cw: NonNullable<Packed<'Note'>['cw']>
+ } | {
+ replyId: NonNullable<Packed<'Note'>['replyId']>
+ } | {
+ poll: NonNullable<Packed<'Note'>['poll']>
+ } | {
+ fileIds: NonNullable<Packed<'Note'>['fileIds']>
+ });
+
+export function isRenotePacked(note: Packed<'Note'>): note is PackedRenote {
+ return note.renoteId != null;
+}
+
+export function isQuotePacked(note: PackedRenote): note is PackedQuote {
+ return note.text != null ||
+ note.cw != null ||
+ note.replyId != null ||
+ note.poll != null ||
+ (note.fileIds != null && note.fileIds.length > 0);
+}
diff --git a/packages/backend/src/server/api/stream/channel.ts b/packages/backend/src/server/api/stream/channel.ts
index 44a143538b..a267d27fba 100644
--- a/packages/backend/src/server/api/stream/channel.ts
+++ b/packages/backend/src/server/api/stream/channel.ts
@@ -4,6 +4,10 @@
*/
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 type { Packed } from '@/misc/json-schema.js';
import type Connection from './Connection.js';
/**
@@ -54,6 +58,24 @@ export default abstract class Channel {
return this.connection.subscriber;
}
+ /*
+ * ミュートとブロックされてるを処理する
+ */
+ protected isNoteMutedOrBlocked(note: Packed<'Note'>): boolean {
+ // 流れてきたNoteがインスタンスミュートしたインスタンスが関わる
+ if (isInstanceMuted(note, new Set<string>(this.userProfile?.mutedInstances ?? []))) return true;
+
+ // 流れてきたNoteがミュートしているユーザーが関わる
+ if (isUserRelated(note, this.userIdsWhoMeMuting)) return true;
+ // 流れてきたNoteがブロックされているユーザーが関わる
+ if (isUserRelated(note, this.userIdsWhoBlockingMe)) return true;
+
+ // 流れてきたNoteがリノートをミュートしてるユーザが行ったもの
+ if (isRenotePacked(note) && !isQuotePacked(note) && this.userIdsWhoMeMutingRenotes.has(note.user.id)) return true;
+
+ return false;
+ }
+
constructor(id: string, connection: Connection) {
this.id = id;
this.connection = connection;
diff --git a/packages/backend/src/server/api/stream/channels/antenna.ts b/packages/backend/src/server/api/stream/channels/antenna.ts
index 135d162e63..4a1d2dd109 100644
--- a/packages/backend/src/server/api/stream/channels/antenna.ts
+++ b/packages/backend/src/server/api/stream/channels/antenna.ts
@@ -4,7 +4,6 @@
*/
import { Injectable } from '@nestjs/common';
-import { isUserRelated } from '@/misc/is-user-related.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { bindThis } from '@/decorators.js';
import type { GlobalEvents } from '@/core/GlobalEventService.js';
@@ -40,12 +39,7 @@ class AntennaChannel extends Channel {
if (data.type === 'note') {
const note = await this.noteEntityService.pack(data.body.id, this.user, { detail: true });
- // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
- // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
-
- if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
+ if (this.isNoteMutedOrBlocked(note)) return;
this.connection.cacheNote(note);
diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts
index 90ee1ecda5..140dd3dd9b 100644
--- a/packages/backend/src/server/api/stream/channels/channel.ts
+++ b/packages/backend/src/server/api/stream/channels/channel.ts
@@ -4,10 +4,10 @@
*/
import { Injectable } from '@nestjs/common';
-import { isUserRelated } from '@/misc/is-user-related.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 Channel, { type MiChannelService } from '../channel.js';
class ChannelChannel extends Channel {
@@ -38,14 +38,9 @@ class ChannelChannel extends Channel {
private async onNote(note: Packed<'Note'>) {
if (note.channelId !== this.channelId) return;
- // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
- // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
+ if (this.isNoteMutedOrBlocked(note)) return;
- if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
-
- if (this.user && note.renoteId && !note.text) {
+ 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;
diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts
index 723b89c908..17116258d8 100644
--- a/packages/backend/src/server/api/stream/channels/global-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts
@@ -4,14 +4,12 @@
*/
import { Injectable } from '@nestjs/common';
-import { checkWordMute } from '@/misc/check-word-mute.js';
-import { isInstanceMuted } from '@/misc/is-instance-muted.js';
-import { isUserRelated } from '@/misc/is-user-related.js';
import type { Packed } from '@/misc/json-schema.js';
import { MetaService } from '@/core/MetaService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { bindThis } from '@/decorators.js';
import { RoleService } from '@/core/RoleService.js';
+import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
import Channel, { type MiChannelService } from '../channel.js';
class GlobalTimelineChannel extends Channel {
@@ -52,26 +50,11 @@ class GlobalTimelineChannel extends Channel {
if (note.visibility !== 'public') return;
if (note.channelId != null) return;
- // 関係ない返信は除外
- if (note.reply && !this.following[note.userId]?.withReplies) {
- const reply = note.reply;
- // 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
- if (reply.userId !== this.user!.id && note.userId !== this.user!.id && reply.userId !== note.userId) return;
- }
-
- if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
-
- // Ignore notes from instances the user has muted
- if (isInstanceMuted(note, new Set<string>(this.userProfile?.mutedInstances ?? []))) return;
-
- // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
- // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
+ if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
- if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
+ if (this.isNoteMutedOrBlocked(note)) return;
- if (this.user && note.renoteId && !note.text) {
+ 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;
diff --git a/packages/backend/src/server/api/stream/channels/hashtag.ts b/packages/backend/src/server/api/stream/channels/hashtag.ts
index 377b1a0162..57bada5d9c 100644
--- a/packages/backend/src/server/api/stream/channels/hashtag.ts
+++ b/packages/backend/src/server/api/stream/channels/hashtag.ts
@@ -5,10 +5,10 @@
import { Injectable } from '@nestjs/common';
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
-import { isUserRelated } from '@/misc/is-user-related.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 Channel, { type MiChannelService } from '../channel.js';
class HashtagChannel extends Channel {
@@ -43,14 +43,9 @@ class HashtagChannel extends Channel {
const matched = this.q.some(tags => tags.every(tag => noteTags.includes(normalizeForSearch(tag))));
if (!matched) return;
- // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
- // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
+ if (this.isNoteMutedOrBlocked(note)) return;
- if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
-
- if (this.user && note.renoteId && !note.text) {
+ 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;
diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts
index f45bf8622e..878a3180cb 100644
--- a/packages/backend/src/server/api/stream/channels/home-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts
@@ -4,12 +4,10 @@
*/
import { Injectable } from '@nestjs/common';
-import { checkWordMute } from '@/misc/check-word-mute.js';
-import { isUserRelated } from '@/misc/is-user-related.js';
-import { isInstanceMuted } from '@/misc/is-instance-muted.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 Channel, { type MiChannelService } from '../channel.js';
class HomeTimelineChannel extends Channel {
@@ -51,9 +49,6 @@ class HomeTimelineChannel extends Channel {
if (!isMe && !Object.hasOwn(this.following, note.userId)) return;
}
- // Ignore notes from instances the user has muted
- if (isInstanceMuted(note, new Set<string>(this.userProfile!.mutedInstances))) return;
-
if (note.visibility === 'followers') {
if (!isMe && !Object.hasOwn(this.following, note.userId)) return;
} else if (note.visibility === 'specified') {
@@ -72,7 +67,7 @@ class HomeTimelineChannel extends Channel {
}
// 純粋なリノート(引用リノートでないリノート)の場合
- if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && note.poll == null) {
+ if (isRenotePacked(note) && !isQuotePacked(note) && note.renote) {
if (!this.withRenotes) return;
if (note.renote.reply) {
const reply = note.renote.reply;
@@ -81,14 +76,9 @@ class HomeTimelineChannel extends Channel {
}
}
- // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
- // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
-
- if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
+ if (this.isNoteMutedOrBlocked(note)) return;
- if (this.user && note.renoteId && !note.text) {
+ 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;
diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts
index d67da6f565..575d23d53c 100644
--- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts
@@ -4,14 +4,12 @@
*/
import { Injectable } from '@nestjs/common';
-import { checkWordMute } from '@/misc/check-word-mute.js';
-import { isUserRelated } from '@/misc/is-user-related.js';
-import { isInstanceMuted } from '@/misc/is-instance-muted.js';
import type { Packed } from '@/misc/json-schema.js';
import { MetaService } from '@/core/MetaService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { bindThis } from '@/decorators.js';
import { RoleService } from '@/core/RoleService.js';
+import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
import Channel, { type MiChannelService } from '../channel.js';
class HybridTimelineChannel extends Channel {
@@ -71,8 +69,7 @@ class HybridTimelineChannel extends Channel {
if (!isMe && !note.visibleUserIds!.includes(this.user!.id)) return;
}
- // Ignore notes from instances the user has muted
- if (isInstanceMuted(note, new Set<string>(this.userProfile!.mutedInstances))) return;
+ if (this.isNoteMutedOrBlocked(note)) return;
if (note.reply) {
const reply = note.reply;
@@ -85,14 +82,7 @@ class HybridTimelineChannel extends Channel {
}
}
- if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
-
- // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
- // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
-
- if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
+ if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
if (this.user && note.renoteId && !note.text) {
if (note.renote && Object.keys(note.renote.reactions).length > 0) {
diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts
index 43d26124ef..442d08ae51 100644
--- a/packages/backend/src/server/api/stream/channels/local-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts
@@ -4,13 +4,12 @@
*/
import { Injectable } from '@nestjs/common';
-import { checkWordMute } from '@/misc/check-word-mute.js';
-import { isUserRelated } from '@/misc/is-user-related.js';
import type { Packed } from '@/misc/json-schema.js';
import { MetaService } from '@/core/MetaService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { bindThis } from '@/decorators.js';
import { RoleService } from '@/core/RoleService.js';
+import { isQuotePacked, isRenotePacked } from '@/misc/is-renote.js';
import Channel, { type MiChannelService } from '../channel.js';
class LocalTimelineChannel extends Channel {
@@ -61,16 +60,11 @@ class LocalTimelineChannel extends Channel {
if (reply.userId !== this.user.id && note.userId !== this.user.id && reply.userId !== note.userId) return;
}
- if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
+ if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
- // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
- // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
+ if (this.isNoteMutedOrBlocked(note)) return;
- if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
-
- if (this.user && note.renoteId && !note.text) {
+ 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;
diff --git a/packages/backend/src/server/api/stream/channels/role-timeline.ts b/packages/backend/src/server/api/stream/channels/role-timeline.ts
index 80aab4b35e..6a4ad22460 100644
--- a/packages/backend/src/server/api/stream/channels/role-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/role-timeline.ts
@@ -4,8 +4,6 @@
*/
import { Injectable } from '@nestjs/common';
-import { isUserRelated } from '@/misc/is-user-related.js';
-import type { Packed } from '@/misc/json-schema.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { bindThis } from '@/decorators.js';
import { RoleService } from '@/core/RoleService.js';
@@ -46,12 +44,7 @@ class RoleTimelineChannel extends Channel {
}
if (note.visibility !== 'public') return;
- // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
- // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
-
- if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
+ if (this.isNoteMutedOrBlocked(note)) return;
this.send('note', note);
} else {
diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts
index f7bb106c03..14b30a157c 100644
--- a/packages/backend/src/server/api/stream/channels/user-list.ts
+++ b/packages/backend/src/server/api/stream/channels/user-list.ts
@@ -5,12 +5,11 @@
import { Inject, Injectable } from '@nestjs/common';
import type { MiUserListMembership, UserListMembershipsRepository, UserListsRepository } from '@/models/_.js';
-import { isUserRelated } from '@/misc/is-user-related.js';
import type { Packed } from '@/misc/json-schema.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';
-import { isInstanceMuted } from '@/misc/is-instance-muted.js';
+import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
import Channel, { type MiChannelService } from '../channel.js';
class UserListChannel extends Channel {
@@ -106,25 +105,17 @@ class UserListChannel extends Channel {
}
}
- if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return;
+ if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
- // 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
- // 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
- if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
+ if (this.isNoteMutedOrBlocked(note)) return;
- if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
-
- if (this.user && note.renoteId && !note.text) {
+ 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;
}
}
- // 流れてきたNoteがミュートしているインスタンスに関わるものだったら無視する
- if (isInstanceMuted(note, this.userMutedInstances)) return;
-
this.connection.cacheNote(note);
this.send('note', note);
diff --git a/packages/backend/test/e2e/renote-mute.ts b/packages/backend/test/e2e/renote-mute.ts
index 9826068e48..1abbb4f044 100644
--- a/packages/backend/test/e2e/renote-mute.ts
+++ b/packages/backend/test/e2e/renote-mute.ts
@@ -63,6 +63,22 @@ describe('Renote Mute', () => {
assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), true);
});
+ // #12956
+ test('タイムラインにリノートミュートしているユーザーの通常ノートのリノートが含まれる', async () => {
+ const carolNote = await post(carol, { text: 'hi' });
+ const bobRenote = await post(bob, { renoteId: carolNote.id });
+
+ // redisに追加されるのを待つ
+ await sleep(100);
+
+ const res = await api('notes/local-timeline', {}, alice);
+
+ assert.strictEqual(res.status, 200);
+ assert.strictEqual(Array.isArray(res.body), true);
+ assert.strictEqual(res.body.some((note: any) => note.id === carolNote.id), true);
+ assert.strictEqual(res.body.some((note: any) => note.id === bobRenote.id), true);
+ });
+
test('ストリームにリノートミュートしているユーザーのリノートが流れない', async () => {
const bobNote = await post(bob, { text: 'hi' });
@@ -86,4 +102,17 @@ describe('Renote Mute', () => {
assert.strictEqual(fired, true);
});
+
+ // #12956
+ test('ストリームにリノートミュートしているユーザーの通常ノートのリノートが流れてくる', async () => {
+ const carolbNote = await post(carol, { text: 'hi' });
+
+ const fired = await waitFire(
+ alice, 'localTimeline',
+ () => api('notes/create', { renoteId: carolbNote.id }, bob),
+ msg => msg.type === 'note' && msg.body.userId === bob.id,
+ );
+
+ assert.strictEqual(fired, true);
+ });
});
diff --git a/packages/backend/test/e2e/streaming.ts b/packages/backend/test/e2e/streaming.ts
index 26bb68ec6c..b0a70074c6 100644
--- a/packages/backend/test/e2e/streaming.ts
+++ b/packages/backend/test/e2e/streaming.ts
@@ -63,7 +63,7 @@ describe('Streaming', () => {
takumiNote = await post(takumi, { text: 'piyo' });
// Follow: ayano => kyoko
- await api('following/create', { userId: kyoko.id }, ayano);
+ await api('following/create', { userId: kyoko.id, withReplies: false }, ayano);
// Follow: ayano => akari
await follow(ayano, akari);
@@ -509,6 +509,16 @@ describe('Streaming', () => {
assert.strictEqual(fired, false);
});
+
+ test('withReplies = falseでフォローしてる人によるリプライが流れてくる', async () => {
+ const fired = await waitFire(
+ ayano, 'globalTimeline', // ayano:Global
+ () => api('notes/create', { text: 'foo', replyId: kanakoNote.id }, kyoko), // kyoko posts
+ msg => msg.type === 'note' && msg.body.userId === kyoko.id, // wait kyoko
+ );
+
+ assert.strictEqual(fired, true);
+ });
});
describe('UserList Timeline', () => {