1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-02 17:55:52 +02:00

perf: early return users/notes and users/featured-notes if me is blocked by requesting user (#12663)

This commit is contained in:
anatawa12
2023-12-15 11:24:13 +09:00
committed by GitHub
parent 5cc3d3c873
commit bd4d8694dd
2 changed files with 16 additions and 3 deletions

View File

@@ -86,6 +86,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (ps.withReplies && ps.withFiles) throw new ApiError(meta.errors.bothWithRepliesAndWithFiles);
// early return if me is blocked by requesting user
if (me != null) {
const userIdsWhoBlockingMe = await this.cacheService.userBlockedCache.fetch(me.id);
if (userIdsWhoBlockingMe.has(ps.userId)) {
return [];
}
}
if (!serverSettings.enableFanoutTimeline) {
const timeline = await this.getFromDb({
untilId,