fix(backend): correct outbox pagination (#16176)
This commit is contained in:
parent
ac9206f192
commit
b5767c315a
|
@ -16,6 +16,7 @@
|
||||||
### Server
|
### Server
|
||||||
- Feat: 全てのチャットメッセージを既読にするAPIを追加(chat/read-all)
|
- Feat: 全てのチャットメッセージを既読にするAPIを追加(chat/read-all)
|
||||||
- Fix: アカウント削除が正常に行われないことがあった問題を修正
|
- Fix: アカウント削除が正常に行われないことがあった問題を修正
|
||||||
|
- Fix: outboxのページネーションが正しく行われない問題を修正
|
||||||
|
|
||||||
|
|
||||||
## 2025.6.0
|
## 2025.6.0
|
||||||
|
|
|
@ -482,9 +482,19 @@ export class ActivityPubServerService {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
dbFallback: async (untilId, sinceId, limit) => {
|
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();
|
if (sinceId) notes.reverse();
|
||||||
|
|
||||||
|
@ -523,16 +533,21 @@ export class ActivityPubServerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async getUserNotesFromDb(untilId: string | null, sinceId: string | null, limit: number, userId: MiUser['id']) {
|
private async getUserNotesFromDb(ps: {
|
||||||
return await this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), sinceId, untilId)
|
untilId: string | null,
|
||||||
.andWhere('note.userId = :userId', { userId })
|
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 => {
|
.andWhere(new Brackets(qb => {
|
||||||
qb
|
qb
|
||||||
.where('note.visibility = \'public\'')
|
.where('note.visibility = \'public\'')
|
||||||
.orWhere('note.visibility = \'home\'');
|
.orWhere('note.visibility = \'home\'');
|
||||||
}))
|
}))
|
||||||
.andWhere('note.localOnly = FALSE')
|
.andWhere('note.localOnly = FALSE')
|
||||||
.limit(limit)
|
.limit(ps.limit)
|
||||||
.getMany();
|
.getMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue