1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-04 02:36:32 +02:00

fix(backend): correct outbox pagination (#16176)

This commit is contained in:
zyoshoka
2025-06-08 09:12:59 +09:00
committed by GitHub
parent ac9206f192
commit b5767c315a
2 changed files with 22 additions and 6 deletions

View File

@@ -482,9 +482,19 @@ export class ActivityPubServerService {
return true;
},
dbFallback: async (untilId, sinceId, limit) => {
return await this.getUserNotesFromDb(sinceId, untilId, limit, user.id);
return await this.getUserNotesFromDb({
untilId,
sinceId,
limit,
userId: user.id,
});
},
}) : await this.getUserNotesFromDb(sinceId ?? null, untilId ?? null, limit, user.id);
}) : await this.getUserNotesFromDb({
untilId: untilId ?? null,
sinceId: sinceId ?? null,
limit,
userId: user.id,
});
if (sinceId) notes.reverse();
@@ -523,16 +533,21 @@ export class ActivityPubServerService {
}
@bindThis
private async getUserNotesFromDb(untilId: string | null, sinceId: string | null, limit: number, userId: MiUser['id']) {
return await this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), sinceId, untilId)
.andWhere('note.userId = :userId', { userId })
private async getUserNotesFromDb(ps: {
untilId: string | null,
sinceId: string | null,
limit: number,
userId: MiUser['id'],
}) {
return await this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId)
.andWhere('note.userId = :userId', { userId: ps.userId })
.andWhere(new Brackets(qb => {
qb
.where('note.visibility = \'public\'')
.orWhere('note.visibility = \'home\'');
}))
.andWhere('note.localOnly = FALSE')
.limit(limit)
.limit(ps.limit)
.getMany();
}