mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-24 19:05:29 +00:00
Merge branch 'master' into master
This commit is contained in:
@@ -130,19 +130,25 @@ router.get(
|
||||
query.take = Math.floor(limit / 2);
|
||||
if (query.take != 0) {
|
||||
const [right, left] = await Promise.all([
|
||||
Message.find({ ...query, where: { id: LessThan(around) } }),
|
||||
Message.find({
|
||||
...query,
|
||||
where: { id: MoreThanOrEqual(around) },
|
||||
where: { channel_id, id: LessThan(around) },
|
||||
}),
|
||||
Message.find({
|
||||
...query,
|
||||
where: { channel_id, id: MoreThanOrEqual(around) },
|
||||
order: { timestamp: "ASC" },
|
||||
}),
|
||||
]);
|
||||
left.push(...right);
|
||||
messages = left;
|
||||
messages = left.sort(
|
||||
(a, b) => a.timestamp.getTime() - b.timestamp.getTime(),
|
||||
);
|
||||
} else {
|
||||
query.take = 1;
|
||||
const message = await Message.findOne({
|
||||
...query,
|
||||
where: { id: around },
|
||||
where: { channel_id, id: around },
|
||||
});
|
||||
messages = message ? [message] : [];
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ router.patch(
|
||||
if (!body.password)
|
||||
throw FieldErrors({
|
||||
password: {
|
||||
message: req.t("auth:register.INVALID_PASSWORD"),
|
||||
message: req.t("auth:login.INVALID_PASSWORD"),
|
||||
code: "INVALID_PASSWORD",
|
||||
},
|
||||
});
|
||||
@@ -160,6 +160,15 @@ router.patch(
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (!body.password) {
|
||||
throw FieldErrors({
|
||||
password: {
|
||||
message: req.t("auth:login.INVALID_PASSWORD"),
|
||||
code: "INVALID_PASSWORD",
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (body.discriminator) {
|
||||
|
||||
Reference in New Issue
Block a user