summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-04-06 18:07:18 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-04-06 18:07:18 +0200
commitfbeb7ce8f83624a4f2edfe2eb1a6bf76e593fc7d (patch)
treee69a1e756efb4956d0f7e62adc2c8b7ef3337e6c
parent:art: Convert id bigint to string (diff)
downloadserver-fbeb7ce8f83624a4f2edfe2eb1a6bf76e593fc7d.tar.xz
:bug: fix bigint id in message route
-rw-r--r--package-lock.json4
-rw-r--r--src/routes/channels/#channel_id/messages/index.ts6
2 files changed, 7 insertions, 3 deletions
diff --git a/package-lock.json b/package-lock.json

index ba585fb6..f17afe1c 100644 --- a/package-lock.json +++ b/package-lock.json
@@ -4614,7 +4614,7 @@ }, "node_modules/fosscord-server-util": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#770b07400e282c5e06fe0638d791139e3984f50f", + "resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#3205dc6f6080422b8d2f727fe9e4573b493ffbb1", "license": "ISC", "dependencies": { "jsonwebtoken": "^8.5.1", @@ -16151,7 +16151,7 @@ "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" }, "fosscord-server-util": { - "version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#770b07400e282c5e06fe0638d791139e3984f50f", + "version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#3205dc6f6080422b8d2f727fe9e4573b493ffbb1", "from": "fosscord-server-util@github:fosscord/fosscord-server-util", "requires": { "jsonwebtoken": "^8.5.1", diff --git a/src/routes/channels/#channel_id/messages/index.ts b/src/routes/channels/#channel_id/messages/index.ts
index 0b91a977..4b9d96a1 100644 --- a/src/routes/channels/#channel_id/messages/index.ts +++ b/src/routes/channels/#channel_id/messages/index.ts
@@ -60,7 +60,11 @@ router.get("/", async (req, res) => { var query: any; if (after) query = MessageModel.find({ channel_id, id: { $gt: after } }); else if (before) query = MessageModel.find({ channel_id, id: { $lt: before } }); - else if (around) query = MessageModel.find({ channel_id, id: { $gt: around - halfLimit, $lt: around + halfLimit } }); + else if (around) + query = MessageModel.find({ + channel_id, + id: { $gt: (BigInt(around) - BigInt(halfLimit)).toString(), $lt: (BigInt(around) + BigInt(halfLimit)).toString() }, + }); else { query = MessageModel.find({ channel_id }).sort({ id: -1 }); }