Skip to content

Commit

Permalink
Send 204 status
Browse files Browse the repository at this point in the history
  • Loading branch information
DEVTomatoCake committed Aug 15, 2024
1 parent 35dde2e commit 475aee3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/api/routes/applications/#id/bot/index.ts
Original file line number Diff line number Diff line change
@@ -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/>.
*/
Expand Down Expand Up @@ -57,7 +57,7 @@ router.post(

res.send({
token: await generateToken(user.id),
}).status(204);
});
},
);

Expand Down
12 changes: 10 additions & 2 deletions src/api/routes/channels/#channel_id/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 4 additions & 4 deletions src/api/routes/read-states/ack-bulk.ts
Original file line number Diff line number Diff line change
@@ -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/>.
*/
Expand Down Expand Up @@ -60,7 +60,7 @@ router.post(
}),
]);

return res.status(204);
return res.sendStatus(204);
},
);

Expand Down
8 changes: 4 additions & 4 deletions src/api/routes/users/@me/notes.ts
Original file line number Diff line number Diff line change
@@ -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/>.
*/
Expand Down Expand Up @@ -107,7 +107,7 @@ router.put(
user_id: owner.id,
});

return res.status(204);
return res.sendStatus(204);
},
);

Expand Down

0 comments on commit 475aee3

Please sign in to comment.