fix null check in local/global/list channels

This commit is contained in:
Hazelnoot 2025-06-03 17:47:03 -04:00
parent 5035287571
commit 0866e87ce6
3 changed files with 4 additions and 4 deletions

View file

@ -65,7 +65,7 @@ class GlobalTimelineChannel extends Channel {
if (!this.isNoteVisibleToMe(reply)) return; if (!this.isNoteVisibleToMe(reply)) return;
if (!this.following[note.userId]?.withReplies) { 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;
} }
} }

View file

@ -50,7 +50,7 @@ class LocalTimelineChannel extends Channel {
@bindThis @bindThis
private async onNote(note: Packed<'Note'>) { 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.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
if (!this.withBots && note.user.isBot) return; if (!this.withBots && note.user.isBot) return;
@ -69,7 +69,7 @@ class LocalTimelineChannel extends Channel {
if (!this.isNoteVisibleToMe(reply)) return; if (!this.isNoteVisibleToMe(reply)) return;
if (!this.following[note.userId]?.withReplies) { 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;
} }
} }

View file

@ -81,7 +81,7 @@ class UserListChannel extends Channel {
@bindThis @bindThis
private async onNote(note: Packed<'Note'>) { private async onNote(note: Packed<'Note'>) {
const isMe = this.user!.id === note.userId; const isMe = this.user?.id === note.userId;
// チャンネル投稿は無視する // チャンネル投稿は無視する
if (note.channelId) return; if (note.channelId) return;