mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 15:22:43 +00:00
correct message sending perms
This commit is contained in:
1 parent
32385959e1
commit
eda0993a9a
1 file changed
+5
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user