Backfilling privilege does not imply right to post messages
This commit is contained in:
parent
2e84840213
commit
122abacf17
@ -93,9 +93,12 @@ router.put(
|
||||
var body = req.body as MessageCreateSchema;
|
||||
const attachments: Attachment[] = [];
|
||||
|
||||
const rights = getRights(req.user_id);
|
||||
rights.hasThrow("SEND_MESSAGES");
|
||||
|
||||
// regex to check if message contains anything other than numerals ( also no decimals )
|
||||
if (!message_id.match(/^\+?\d+$/)) {
|
||||
throw new HTTPError("Message IDs must be positive integers")
|
||||
throw new HTTPError("Message IDs must be positive integers", 400);
|
||||
}
|
||||
|
||||
const snowflake = Snowflake.deconstruct(message_id)
|
||||
@ -106,7 +109,7 @@ router.put(
|
||||
|
||||
const exists = await Message.findOne({ where: { id: message_id, channel_id: channel_id }});
|
||||
if (exists) {
|
||||
throw new HTTPError("Cannot backfill to message ID that already exists", 400);
|
||||
throw new HTTPError("Cannot backfill to message ID that already exists", 409);
|
||||
}
|
||||
|
||||
if (req.file) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user