mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 16:38:23 +01:00
exclude -> include
This commit is contained in:
parent
4827fbdd10
commit
d95543d05b
7 changed files with 6 additions and 10 deletions
|
@ -35,7 +35,7 @@ type TimelineOptions = {
|
||||||
excludeNoFiles?: boolean;
|
excludeNoFiles?: boolean;
|
||||||
excludeReplies?: boolean;
|
excludeReplies?: boolean;
|
||||||
excludePureRenotes: boolean;
|
excludePureRenotes: boolean;
|
||||||
excludeMutedChannels?: boolean;
|
includeMutedChannels?: boolean;
|
||||||
dbFallback: (untilId: string | null, sinceId: string | null, limit: number) => Promise<MiNote[]>,
|
dbFallback: (untilId: string | null, sinceId: string | null, limit: number) => Promise<MiNote[]>,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ export class FanoutTimelineEndpointService {
|
||||||
this.cacheService.renoteMutingsCache.fetch(ps.me.id),
|
this.cacheService.renoteMutingsCache.fetch(ps.me.id),
|
||||||
this.cacheService.userBlockedCache.fetch(ps.me.id),
|
this.cacheService.userBlockedCache.fetch(ps.me.id),
|
||||||
this.cacheService.userProfileCache.fetch(me.id).then(p => new Set(p.mutedInstances)),
|
this.cacheService.userProfileCache.fetch(me.id).then(p => new Set(p.mutedInstances)),
|
||||||
ps.excludeMutedChannels ? this.channelMutingService.mutingChannelsCache.fetch(me.id) : Promise.resolve(new Set<string>()),
|
ps.includeMutedChannels ? Promise.resolve(new Set<string>()) : this.channelMutingService.mutingChannelsCache.fetch(me.id),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const parentFilter = filter;
|
const parentFilter = filter;
|
||||||
|
@ -120,7 +120,7 @@ export class FanoutTimelineEndpointService {
|
||||||
if (isUserRelated(note, userIdsWhoMeMuting, ps.ignoreAuthorFromMute)) return false;
|
if (isUserRelated(note, userIdsWhoMeMuting, ps.ignoreAuthorFromMute)) return false;
|
||||||
if (!ps.ignoreAuthorFromMute && isRenote(note) && !isQuote(note) && userIdsWhoMeMutingRenotes.has(note.userId)) return false;
|
if (!ps.ignoreAuthorFromMute && isRenote(note) && !isQuote(note) && userIdsWhoMeMutingRenotes.has(note.userId)) return false;
|
||||||
if (isInstanceMuted(note, userMutedInstances)) return false;
|
if (isInstanceMuted(note, userMutedInstances)) return false;
|
||||||
if (ps.excludeMutedChannels && isChannelRelated(note, userMutedChannels)) return false;
|
if (!ps.includeMutedChannels && isChannelRelated(note, userMutedChannels)) return false;
|
||||||
|
|
||||||
return parentFilter(note);
|
return parentFilter(note);
|
||||||
};
|
};
|
||||||
|
|
|
@ -104,6 +104,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
useDbFallback: true,
|
useDbFallback: true,
|
||||||
redisTimelines: [`channelTimeline:${channel.id}`],
|
redisTimelines: [`channelTimeline:${channel.id}`],
|
||||||
excludePureRenotes: false,
|
excludePureRenotes: false,
|
||||||
|
includeMutedChannels: true,
|
||||||
noteFilter: note => {
|
noteFilter: note => {
|
||||||
// 共通機能を使うと見ているチャンネルそのものもミュートしてしまうので閲覧中のチャンネル以外を除く形にする
|
// 共通機能を使うと見ているチャンネルそのものもミュートしてしまうので閲覧中のチャンネル以外を除く形にする
|
||||||
if (note.channelId === channel.id && (note.renoteChannelId === null || note.renoteChannelId === channel.id)) return true;
|
if (note.channelId === channel.id && (note.renoteChannelId === null || note.renoteChannelId === channel.id)) return true;
|
||||||
|
|
|
@ -19,8 +19,8 @@ import { UserFollowingService } from '@/core/UserFollowingService.js';
|
||||||
import { MiLocalUser } from '@/models/User.js';
|
import { MiLocalUser } from '@/models/User.js';
|
||||||
import { FanoutTimelineEndpointService } from '@/core/FanoutTimelineEndpointService.js';
|
import { FanoutTimelineEndpointService } from '@/core/FanoutTimelineEndpointService.js';
|
||||||
import { ChannelMutingService } from '@/core/ChannelMutingService.js';
|
import { ChannelMutingService } from '@/core/ChannelMutingService.js';
|
||||||
|
import { ChannelFollowingService } from '@/core/ChannelFollowingService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
import { ChannelFollowingService } from "@/core/ChannelFollowingService.js";
|
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['notes'],
|
tags: ['notes'],
|
||||||
|
@ -159,7 +159,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
useDbFallback: this.serverSettings.enableFanoutTimelineDbFallback,
|
useDbFallback: this.serverSettings.enableFanoutTimelineDbFallback,
|
||||||
alwaysIncludeMyNotes: true,
|
alwaysIncludeMyNotes: true,
|
||||||
excludePureRenotes: !ps.withRenotes,
|
excludePureRenotes: !ps.withRenotes,
|
||||||
excludeMutedChannels: true,
|
|
||||||
noteFilter: note => {
|
noteFilter: note => {
|
||||||
if (note.reply && note.reply.visibility === 'followers') {
|
if (note.reply && note.reply.visibility === 'followers') {
|
||||||
if (!Object.hasOwn(followings, note.reply.userId) && note.reply.userId !== me.id) return false;
|
if (!Object.hasOwn(followings, note.reply.userId) && note.reply.userId !== me.id) return false;
|
||||||
|
|
|
@ -122,7 +122,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
: ['localTimeline'],
|
: ['localTimeline'],
|
||||||
alwaysIncludeMyNotes: true,
|
alwaysIncludeMyNotes: true,
|
||||||
excludePureRenotes: !ps.withRenotes,
|
excludePureRenotes: !ps.withRenotes,
|
||||||
excludeMutedChannels: true,
|
|
||||||
dbFallback: async (untilId, sinceId, limit) => await this.getFromDb({
|
dbFallback: async (untilId, sinceId, limit) => await this.getFromDb({
|
||||||
untilId,
|
untilId,
|
||||||
sinceId,
|
sinceId,
|
||||||
|
|
|
@ -112,7 +112,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
redisTimelines: ps.withFiles ? [`homeTimelineWithFiles:${me.id}`] : [`homeTimeline:${me.id}`],
|
redisTimelines: ps.withFiles ? [`homeTimelineWithFiles:${me.id}`] : [`homeTimeline:${me.id}`],
|
||||||
alwaysIncludeMyNotes: true,
|
alwaysIncludeMyNotes: true,
|
||||||
excludePureRenotes: !ps.withRenotes,
|
excludePureRenotes: !ps.withRenotes,
|
||||||
excludeMutedChannels: true,
|
|
||||||
noteFilter: note => {
|
noteFilter: note => {
|
||||||
if (note.reply && note.reply.visibility === 'followers') {
|
if (note.reply && note.reply.visibility === 'followers') {
|
||||||
if (!Object.hasOwn(followings, note.reply.userId) && note.reply.userId !== me.id) return false;
|
if (!Object.hasOwn(followings, note.reply.userId) && note.reply.userId !== me.id) return false;
|
||||||
|
|
|
@ -14,8 +14,8 @@ import { IdService } from '@/core/IdService.js';
|
||||||
import { QueryService } from '@/core/QueryService.js';
|
import { QueryService } from '@/core/QueryService.js';
|
||||||
import { MiLocalUser } from '@/models/User.js';
|
import { MiLocalUser } from '@/models/User.js';
|
||||||
import { FanoutTimelineEndpointService } from '@/core/FanoutTimelineEndpointService.js';
|
import { FanoutTimelineEndpointService } from '@/core/FanoutTimelineEndpointService.js';
|
||||||
|
import { ChannelMutingService } from '@/core/ChannelMutingService.js';
|
||||||
import { ApiError } from '../../error.js';
|
import { ApiError } from '../../error.js';
|
||||||
import { ChannelMutingService } from "@/core/ChannelMutingService.js";
|
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['notes', 'lists'],
|
tags: ['notes', 'lists'],
|
||||||
|
@ -127,7 +127,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
redisTimelines: ps.withFiles ? [`userListTimelineWithFiles:${list.id}`] : [`userListTimeline:${list.id}`],
|
redisTimelines: ps.withFiles ? [`userListTimelineWithFiles:${list.id}`] : [`userListTimeline:${list.id}`],
|
||||||
alwaysIncludeMyNotes: true,
|
alwaysIncludeMyNotes: true,
|
||||||
excludePureRenotes: !ps.withRenotes,
|
excludePureRenotes: !ps.withRenotes,
|
||||||
excludeMutedChannels: true,
|
|
||||||
dbFallback: async (untilId, sinceId, limit) => await this.getFromDb(list, {
|
dbFallback: async (untilId, sinceId, limit) => await this.getFromDb(list, {
|
||||||
untilId,
|
untilId,
|
||||||
sinceId,
|
sinceId,
|
||||||
|
|
|
@ -133,7 +133,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
excludeReplies: ps.withChannelNotes && !ps.withReplies, // userTimelineWithChannel may include replies
|
excludeReplies: ps.withChannelNotes && !ps.withReplies, // userTimelineWithChannel may include replies
|
||||||
excludeNoFiles: ps.withChannelNotes && ps.withFiles, // userTimelineWithChannel may include notes without files
|
excludeNoFiles: ps.withChannelNotes && ps.withFiles, // userTimelineWithChannel may include notes without files
|
||||||
excludePureRenotes: !ps.withRenotes,
|
excludePureRenotes: !ps.withRenotes,
|
||||||
excludeMutedChannels: true,
|
|
||||||
noteFilter: note => {
|
noteFilter: note => {
|
||||||
if (note.channel?.isSensitive && !isSelf) return false;
|
if (note.channel?.isSensitive && !isSelf) return false;
|
||||||
if (note.visibility === 'specified' && (!me || (me.id !== note.userId && !note.visibleUserIds.some(v => v === me.id)))) return false;
|
if (note.visibility === 'specified' && (!me || (me.id !== note.userId && !note.visibleUserIds.some(v => v === me.id)))) return false;
|
||||||
|
|
Loading…
Reference in a new issue