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' }); }