From 0866e87ce6bdc0b621cbb0663728cf837970f94c Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Tue, 3 Jun 2025 17:47:03 -0400 Subject: [PATCH] fix null check in local/global/list channels --- .../backend/src/server/api/stream/channels/global-timeline.ts | 2 +- .../backend/src/server/api/stream/channels/local-timeline.ts | 4 ++-- packages/backend/src/server/api/stream/channels/user-list.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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 515deb1253..bac0277538 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -65,7 +65,7 @@ class GlobalTimelineChannel extends Channel { if (!this.isNoteVisibleToMe(reply)) return; if (!this.following[note.userId]?.withReplies) { // 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合 - if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return; + if (reply.userId !== this.user?.id && !isMe && reply.userId !== note.userId) return; } } 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 70b02d9580..2eb3460efa 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -50,7 +50,7 @@ class LocalTimelineChannel extends Channel { @bindThis private async onNote(note: Packed<'Note'>) { - const isMe = this.user!.id === note.userId; + const isMe = this.user?.id === note.userId; if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return; if (!this.withBots && note.user.isBot) return; @@ -69,7 +69,7 @@ class LocalTimelineChannel extends Channel { if (!this.isNoteVisibleToMe(reply)) return; if (!this.following[note.userId]?.withReplies) { // 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合 - if (reply.userId !== this.user!.id && !isMe && reply.userId !== note.userId) return; + if (reply.userId !== this.user?.id && !isMe && reply.userId !== note.userId) return; } } 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 8a7c2b2633..06619d1208 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -81,7 +81,7 @@ class UserListChannel extends Channel { @bindThis private async onNote(note: Packed<'Note'>) { - const isMe = this.user!.id === note.userId; + const isMe = this.user?.id === note.userId; // チャンネル投稿は無視する if (note.channelId) return;