From eda0993a9a8737439c48691925ba332b2d4add08 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Tue, 3 Feb 2026 15:33:28 -0600 Subject: [PATCH] correct message sending perms --- src/api/routes/channels/#channel_id/messages/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts index 110e89017..7f8b4b955 100644 --- a/src/api/routes/channels/#channel_id/messages/index.ts +++ b/src/api/routes/channels/#channel_id/messages/index.ts @@ -315,7 +315,6 @@ router.post( }, route({ requestBody: "MessageCreateSchema", - permission: "SEND_MESSAGES", right: "SEND_MESSAGES", responses: { 200: { @@ -337,6 +336,11 @@ router.post( where: { id: channel_id }, relations: { recipients: { user: true } }, }); + if (channel.isThread()) { + req.permission!.hasThrow("SEND_MESSAGES_IN_THREADS"); + } else { + req.permission!.hasThrow("SEND_MESSAGES"); + } if (!channel.isWritable()) { throw new HTTPError(`Cannot send messages to channel of type ${channel.type}`, 400); }