summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/FanoutTimelineEndpointService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/core/FanoutTimelineEndpointService.ts')
-rw-r--r--packages/backend/src/core/FanoutTimelineEndpointService.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/backend/src/core/FanoutTimelineEndpointService.ts b/packages/backend/src/core/FanoutTimelineEndpointService.ts
index 1ffeb4b3a4..6253f792ed 100644
--- a/packages/backend/src/core/FanoutTimelineEndpointService.ts
+++ b/packages/backend/src/core/FanoutTimelineEndpointService.ts
@@ -36,6 +36,7 @@ type TimelineOptions = {
excludeNoFiles?: boolean;
excludeReplies?: boolean;
excludePureRenotes: boolean;
+ ignoreAuthorFromUserSuspension?: boolean;
dbFallback: (untilId: string | null, sinceId: string | null, limit: number) => Promise<MiNote[]>,
};
@@ -139,6 +140,23 @@ export class FanoutTimelineEndpointService {
};
}
+ {
+ const parentFilter = filter;
+ filter = (note) => {
+ const noteJoined = note as MiNote & {
+ renoteUser: MiUser | null;
+ replyUser: MiUser | null;
+ };
+ if (!ps.ignoreAuthorFromUserSuspension) {
+ if (note.user!.isSuspended) return false;
+ }
+ if (note.userId !== note.renoteUserId && noteJoined.renoteUser?.isSuspended) return false;
+ if (note.userId !== note.replyUserId && noteJoined.replyUser?.isSuspended) return false;
+
+ return parentFilter(note);
+ };
+ }
+
const redisTimeline: MiNote[] = [];
let readFromRedis = 0;
let lastSuccessfulRate = 1; // rateをキャッシュする?