port changes from global timeline to bubble timeline

This commit is contained in:
dakkar 2024-05-11 12:38:01 +01:00
parent b8ce9f0b0f
commit 91ef2ceed7

View file

@ -4,15 +4,13 @@
*/ */
import { Injectable } from '@nestjs/common'; 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 type { Packed } from '@/misc/json-schema.js';
import { MetaService } from '@/core/MetaService.js'; import { MetaService } from '@/core/MetaService.js';
import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
import { RoleService } from '@/core/RoleService.js'; import { RoleService } from '@/core/RoleService.js';
import type { MiMeta } from '@/models/Meta.js'; import type { MiMeta } from '@/models/Meta.js';
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
import Channel, { MiChannelService } from '../channel.js'; import Channel, { MiChannelService } from '../channel.js';
class BubbleTimelineChannel extends Channel { class BubbleTimelineChannel extends Channel {
@ -59,31 +57,13 @@ class BubbleTimelineChannel extends Channel {
if (note.channelId != null) return; if (note.channelId != null) return;
// 関係ない返信は除外 if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) 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.user.isSilenced && !this.following[note.userId] && note.userId !== this.user!.id) return; if (note.user.isSilenced && !this.following[note.userId] && note.userId !== this.user!.id) return;
if (note.renote && note.text == null && (note.fileIds == null || note.fileIds.length === 0) && !this.withRenotes) return; if (this.isNoteMutedOrBlocked(note)) return;
// Ignore notes from instances the user has muted if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
if (isInstanceMuted(note, new Set<string>(this.userProfile?.mutedInstances ?? [])) && !this.following[note.userId]) return;
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
if (isUserRelated(note, this.userIdsWhoMeMuting)) return;
// 流れてきたNoteがブロックされているユーザーが関わるものだったら無視する
if (isUserRelated(note, this.userIdsWhoBlockingMe)) return;
if (note.renote && !note.text && note.renote.mentions?.some(mention => this.userIdsWhoMeMuting.has(mention))) return;
if (note.mentions?.some(mention => this.userIdsWhoMeMuting.has(mention))) return;
if (note.renote && !note.text && isUserRelated(note, this.userIdsWhoMeMutingRenotes)) return;
if (this.user && note.renoteId && !note.text) {
if (note.renote && Object.keys(note.renote.reactions).length > 0) { if (note.renote && Object.keys(note.renote.reactions).length > 0) {
const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id); const myRenoteReaction = await this.noteEntityService.populateMyReaction(note.renote, this.user.id);
note.renote.myReaction = myRenoteReaction; note.renote.myReaction = myRenoteReaction;