From edf847d966fddc348a1617643bb4b945fb636a43 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 9 Oct 2023 21:23:07 +0900 Subject: [PATCH 1/4] fix of 0bb0c32908 --- .../backend/src/core/RedisTimelineService.ts | 16 ++++++++-------- .../src/server/api/endpoints/antennas/notes.ts | 4 ++-- .../server/api/endpoints/channels/timeline.ts | 4 ++-- .../api/endpoints/notes/hybrid-timeline.ts | 4 ++-- .../server/api/endpoints/notes/local-timeline.ts | 4 ++-- .../src/server/api/endpoints/notes/timeline.ts | 4 ++-- .../api/endpoints/notes/user-list-timeline.ts | 4 ++-- .../src/server/api/endpoints/roles/notes.ts | 4 ++-- .../src/server/api/endpoints/users/notes.ts | 4 ++-- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/backend/src/core/RedisTimelineService.ts b/packages/backend/src/core/RedisTimelineService.ts index f0ca2726d6..2f110c014e 100644 --- a/packages/backend/src/core/RedisTimelineService.ts +++ b/packages/backend/src/core/RedisTimelineService.ts @@ -44,16 +44,16 @@ export class RedisTimelineService { public get(name: string, untilId?: string | null, sinceId?: string | null) { if (untilId && sinceId) { return this.redisForTimelines.lrange('list:' + name, 0, -1) - .then(ids => ids.filter(id => id > untilId && id < sinceId).sort((a, b) => a > b ? -1 : 1)); + .then(ids => ids.filter(id => id < untilId && id > sinceId).sort((a, b) => a > b ? -1 : 1)); } else if (untilId) { return this.redisForTimelines.lrange('list:' + name, 0, -1) - .then(ids => ids.filter(id => id > untilId).sort((a, b) => a > b ? -1 : 1)); + .then(ids => ids.filter(id => id < untilId).sort((a, b) => a > b ? -1 : 1)); } else if (sinceId) { return this.redisForTimelines.lrange('list:' + name, 0, -1) - .then(ids => ids.filter(id => id < sinceId).sort((a, b) => a < b ? -1 : 1)); + .then(ids => ids.filter(id => id > sinceId).sort((a, b) => a < b ? -1 : 1)); } else { return this.redisForTimelines.lrange('list:' + name, 0, -1) - .then(ids => ids.sort((a, b) => a > b ? -1 : 1)); + .then(ids => ids.sort((a, b) => a < b ? -1 : 1)); } } @@ -68,12 +68,12 @@ export class RedisTimelineService { const tls = res.map(r => r[1] as string[]); return tls.map(ids => (untilId && sinceId) - ? ids.filter(id => id > untilId && id < sinceId).sort((a, b) => a > b ? -1 : 1) + ? ids.filter(id => id < untilId && id > sinceId).sort((a, b) => a > b ? -1 : 1) : untilId - ? ids.filter(id => id > untilId).sort((a, b) => a > b ? -1 : 1) + ? ids.filter(id => id < untilId).sort((a, b) => a > b ? -1 : 1) : sinceId - ? ids.filter(id => id < sinceId).sort((a, b) => a < b ? -1 : 1) - : ids.sort((a, b) => a > b ? -1 : 1), + ? ids.filter(id => id > sinceId).sort((a, b) => a < b ? -1 : 1) + : ids.sort((a, b) => a < b ? -1 : 1), ); }); } diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index 7d6841563a..1a78bf26df 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -73,8 +73,8 @@ export default class extends Endpoint { // eslint- private redisTimelineService: RedisTimelineService, ) { super(meta, paramDef, async (ps, me) => { - const untilId = ps.untilId ?? ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null; - const sinceId = ps.sinceId ?? ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null; + const untilId = ps.untilId ?? (ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null); + const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null); const antenna = await this.antennasRepository.findOneBy({ id: ps.antennaId, diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index e063e0e2fc..4385c698eb 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -74,8 +74,8 @@ export default class extends Endpoint { // eslint- private activeUsersChart: ActiveUsersChart, ) { super(meta, paramDef, async (ps, me) => { - const untilId = ps.untilId ?? ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null; - const sinceId = ps.sinceId ?? ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null; + const untilId = ps.untilId ?? (ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null); + const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null); const isRangeSpecified = untilId != null && sinceId != null; const channel = await this.channelsRepository.findOneBy({ diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index a05269794c..1b77285d47 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -76,8 +76,8 @@ export default class extends Endpoint { // eslint- private redisTimelineService: RedisTimelineService, ) { super(meta, paramDef, async (ps, me) => { - const untilId = ps.untilId ?? ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null; - const sinceId = ps.sinceId ?? ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null; + const untilId = ps.untilId ?? (ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null); + const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null); const policies = await this.roleService.getUserPolicies(me.id); if (!policies.ltlAvailable) { diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index c8ea003ba6..2357f32d5e 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -72,8 +72,8 @@ export default class extends Endpoint { // eslint- private redisTimelineService: RedisTimelineService, ) { super(meta, paramDef, async (ps, me) => { - const untilId = ps.untilId ?? ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null; - const sinceId = ps.sinceId ?? ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null; + const untilId = ps.untilId ?? (ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null); + const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null); const policies = await this.roleService.getUserPolicies(me ? me.id : null); if (!policies.ltlAvailable) { diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index cd45135f99..760d52c9db 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -66,8 +66,8 @@ export default class extends Endpoint { // eslint- private redisTimelineService: RedisTimelineService, ) { super(meta, paramDef, async (ps, me) => { - const untilId = ps.untilId ?? ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null; - const sinceId = ps.sinceId ?? ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null; + const untilId = ps.untilId ?? (ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null); + const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null); const [ followings, diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index 96c8ff5b1b..f7ee58264e 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -83,8 +83,8 @@ export default class extends Endpoint { // eslint- private redisTimelineService: RedisTimelineService, ) { super(meta, paramDef, async (ps, me) => { - const untilId = ps.untilId ?? ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null; - const sinceId = ps.sinceId ?? ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null; + const untilId = ps.untilId ?? (ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null); + const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null); const list = await this.userListsRepository.findOneBy({ id: ps.listId, diff --git a/packages/backend/src/server/api/endpoints/roles/notes.ts b/packages/backend/src/server/api/endpoints/roles/notes.ts index 366c3a7cc1..0db51abc55 100644 --- a/packages/backend/src/server/api/endpoints/roles/notes.ts +++ b/packages/backend/src/server/api/endpoints/roles/notes.ts @@ -69,8 +69,8 @@ export default class extends Endpoint { // eslint- private redisTimelineService: RedisTimelineService, ) { super(meta, paramDef, async (ps, me) => { - const untilId = ps.untilId ?? ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null; - const sinceId = ps.sinceId ?? ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null; + const untilId = ps.untilId ?? (ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null); + const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null); const role = await this.rolesRepository.findOneBy({ id: ps.roleId, diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index 30cd5b791f..d2a65142a5 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -74,8 +74,8 @@ export default class extends Endpoint { // eslint- private redisTimelineService: RedisTimelineService, ) { super(meta, paramDef, async (ps, me) => { - const untilId = ps.untilId ?? ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null; - const sinceId = ps.sinceId ?? ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null; + const untilId = ps.untilId ?? (ps.untilDate ? this.idService.genId(new Date(ps.untilDate!)) : null); + const sinceId = ps.sinceId ?? (ps.sinceDate ? this.idService.genId(new Date(ps.sinceDate!)) : null); const isRangeSpecified = untilId != null && sinceId != null; if (isRangeSpecified || sinceId == null) { From fc777be7bc279a5c04153d838223327ec69b1266 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 9 Oct 2023 21:23:18 +0900 Subject: [PATCH 2/4] 2023.10.0-beta.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b5dcedc5c0..adbd811351 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2023.10.0-beta.13", + "version": "2023.10.0-beta.14", "codename": "nasubi", "repository": { "type": "git", From 8ab364029142991b4e71030cdce070650c13a6ea Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 9 Oct 2023 21:52:31 +0900 Subject: [PATCH 3/4] fix of 0bb0c32908 --- packages/backend/src/core/RedisTimelineService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/RedisTimelineService.ts b/packages/backend/src/core/RedisTimelineService.ts index 2f110c014e..94541759cc 100644 --- a/packages/backend/src/core/RedisTimelineService.ts +++ b/packages/backend/src/core/RedisTimelineService.ts @@ -53,7 +53,7 @@ export class RedisTimelineService { .then(ids => ids.filter(id => id > sinceId).sort((a, b) => a < b ? -1 : 1)); } else { return this.redisForTimelines.lrange('list:' + name, 0, -1) - .then(ids => ids.sort((a, b) => a < b ? -1 : 1)); + .then(ids => ids.sort((a, b) => a > b ? -1 : 1)); } } @@ -73,7 +73,7 @@ export class RedisTimelineService { ? ids.filter(id => id < untilId).sort((a, b) => a > b ? -1 : 1) : sinceId ? ids.filter(id => id > sinceId).sort((a, b) => a < b ? -1 : 1) - : ids.sort((a, b) => a < b ? -1 : 1), + : ids.sort((a, b) => a > b ? -1 : 1), ); }); } From 4eb9e50a362a58a408b49b00cc20c9a1ded6a2e3 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 9 Oct 2023 21:52:43 +0900 Subject: [PATCH 4/4] 2023.10.0-beta.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index adbd811351..270385425d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2023.10.0-beta.14", + "version": "2023.10.0-beta.15", "codename": "nasubi", "repository": { "type": "git",