fix(backend): 「ファイル付きのみ」のTLでファイル無しの新着ノートが表示される

Fix #11939
This commit is contained in:
syuilo 2023-10-09 17:48:09 +09:00
parent 7066d61730
commit 6ff98846e6
7 changed files with 22 additions and 3 deletions

View file

@ -18,6 +18,7 @@ class LocalTimelineChannel extends Channel {
public static shouldShare = false;
public static requireCredential = false;
private withRenotes: boolean;
private withFiles: boolean;
constructor(
private metaService: MetaService,
@ -37,6 +38,7 @@ class LocalTimelineChannel extends Channel {
if (!policies.ltlAvailable) return;
this.withRenotes = params.withRenotes ?? true;
this.withFiles = params.withFiles ?? false;
// Subscribe events
this.subscriber.on('notesStream', this.onNote);
@ -44,6 +46,8 @@ class LocalTimelineChannel extends Channel {
@bindThis
private async onNote(note: Packed<'Note'>) {
if (this.withFiles && (note.fileIds == null || note.fileIds.length === 0)) return;
if (note.user.host !== null) return;
if (note.visibility !== 'public') return;
if (note.channelId != null && !this.followingChannels.has(note.channelId)) return;