summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/notes/timeline.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-07 17:48:10 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-07 17:48:10 +0900
commitfb3338029bdb72543345c9a69cbe5318b5676233 (patch)
tree6afeff8b28dcbb474edbd1e7fbf878c245c57542 /packages/backend/src/server/api/endpoints/notes/timeline.ts
parent2023.10.0-beta.6 (diff)
downloadsharkey-fb3338029bdb72543345c9a69cbe5318b5676233.tar.gz
sharkey-fb3338029bdb72543345c9a69cbe5318b5676233.tar.bz2
sharkey-fb3338029bdb72543345c9a69cbe5318b5676233.zip
refactor
Diffstat (limited to 'packages/backend/src/server/api/endpoints/notes/timeline.ts')
-rw-r--r--packages/backend/src/server/api/endpoints/notes/timeline.ts16
1 files changed, 6 insertions, 10 deletions
diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts
index 7442356978..cd2ec8fe29 100644
--- a/packages/backend/src/server/api/endpoints/notes/timeline.ts
+++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts
@@ -79,17 +79,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
let timeline: MiNote[] = [];
const limit = ps.limit + (ps.untilId ? 1 : 0) + (ps.sinceId ? 1 : 0); // untilIdに指定したものも含まれるため+1
- let noteIdsRes: [string, string[]][] = [];
- if (!ps.sinceId && !ps.sinceDate) {
- noteIdsRes = await this.redisForTimelines.xrevrange(
- ps.withFiles ? `homeTimelineWithFiles:${me.id}` : `homeTimeline:${me.id}`,
- ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : ps.untilDate ?? '+',
- ps.sinceId ? this.idService.parse(ps.sinceId).date.getTime() : ps.sinceDate ?? '-',
- 'COUNT', limit);
- }
-
- const noteIds = noteIdsRes.map(x => x[1][1]).filter(x => x !== ps.untilId && x !== ps.sinceId);
+ const noteIds = await this.redisForTimelines.xrevrange(
+ ps.withFiles ? `homeTimelineWithFiles:${me.id}` : `homeTimeline:${me.id}`,
+ ps.untilId ? this.idService.parse(ps.untilId).date.getTime() : ps.untilDate ?? '+',
+ ps.sinceId ? this.idService.parse(ps.sinceId).date.getTime() : ps.sinceDate ?? '-',
+ 'COUNT', limit,
+ ).then(res => res.map(x => x[1][1]).filter(x => x !== ps.untilId && x !== ps.sinceId));
if (noteIds.length === 0) {
return [];