1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-22 02:12:40 +01:00

Merge pull request #1175 from DEVTomatoCake/fix/send-204-status

This commit is contained in:
Madeline 2024-08-15 20:38:52 +10:00 committed by GitHub
commit 771d6a2ab8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 14 deletions

View File

@ -1,17 +1,17 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@ -57,7 +57,7 @@ router.post(
res.send({
token: await generateToken(user.id),
}).status(204);
});
},
);

View File

@ -155,12 +155,20 @@ router.get(
} else {
if (after) {
if (BigInt(after) > BigInt(Snowflake.generate()))
return res.status(422);
throw new HTTPError(
"after parameter must not be greater than current time",
422,
);
query.where.id = MoreThan(after);
query.order = { timestamp: "ASC" };
} else if (before) {
if (BigInt(before) > BigInt(Snowflake.generate()))
return res.status(422);
throw new HTTPError(
"before parameter must not be greater than current time",
422,
);
query.where.id = LessThan(before);
}

View File

@ -1,17 +1,17 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@ -60,7 +60,7 @@ router.post(
}),
]);
return res.status(204);
return res.sendStatus(204);
},
);

View File

@ -1,17 +1,17 @@
/*
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
Copyright (C) 2023 Spacebar and Spacebar Contributors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@ -107,7 +107,7 @@ router.put(
user_id: owner.id,
});
return res.status(204);
return res.sendStatus(204);
},
);