perf: early return users/notes and users/featured-notes if me is blocked by requesting user (#12663)
This commit is contained in:
parent
5cc3d3c873
commit
bd4d8694dd
2 changed files with 16 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue