From 1d4a13f3727b1b57bb1efd318229a440b762f24e Mon Sep 17 00:00:00 2001 From: Lukian Date: Thu, 3 Apr 2025 12:43:05 +0200 Subject: [PATCH] fix: fixed message deleting --- back/api/channels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/api/channels.js b/back/api/channels.js index c5d6a1d..c91da4f 100644 --- a/back/api/channels.js +++ b/back/api/channels.js @@ -84,7 +84,7 @@ router.post('/:name/messages/delete', async (req, res) => { return res.status(400).send({ error: 'No channel found' }); } - if (user.id !== channel[0].owner_id && user.id !== message.user_id && user.admin !== 1) { + if (user.id !== channel[0].owner_id && user.id !== message[0].user_id && user.admin !== 1) { connection.end(); return res.status(401).send({ error: 'Unauthorized' }); }