summaryrefslogtreecommitdiff
path: root/packages/backend/src
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-07 18:21:16 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-07 18:21:16 +0900
commit986623dbdca61473fb4e60ff746c6c77e3a9d442 (patch)
tree095f9d1089cda3053cc2dfd4160864ff855d7169 /packages/backend/src
parentenhance(backend): User TLをRedisにキャッシュされる以前まで遡... (diff)
downloadsharkey-986623dbdca61473fb4e60ff746c6c77e3a9d442.tar.gz
sharkey-986623dbdca61473fb4e60ff746c6c77e3a9d442.tar.bz2
sharkey-986623dbdca61473fb4e60ff746c6c77e3a9d442.zip
fix(backend): fix sql error when featured notes is zero
Diffstat (limited to 'packages/backend/src')
-rw-r--r--packages/backend/src/server/api/endpoints/users/featured-notes.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/backend/src/server/api/endpoints/users/featured-notes.ts b/packages/backend/src/server/api/endpoints/users/featured-notes.ts
index fdf36a6ae0..dec0b7a122 100644
--- a/packages/backend/src/server/api/endpoints/users/featured-notes.ts
+++ b/packages/backend/src/server/api/endpoints/users/featured-notes.ts
@@ -50,16 +50,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
super(meta, paramDef, async (ps, me) => {
let noteIds = await this.featuredService.getPerUserNotesRanking(ps.userId, 50);
- if (noteIds.length === 0) {
- return [];
- }
-
noteIds.sort((a, b) => a > b ? -1 : 1);
if (ps.untilId) {
noteIds = noteIds.filter(id => id < ps.untilId!);
}
noteIds = noteIds.slice(0, ps.limit);
+ if (noteIds.length === 0) {
+ return [];
+ }
+
const query = this.notesRepository.createQueryBuilder('note')
.where('note.id IN (:...noteIds)', { noteIds: noteIds })
.innerJoinAndSelect('note.user', 'user')