generated from lucien/api-template
fix:: fixed unexistant function in message deletion
This commit is contained in:
parent
d38c963bab
commit
92ea1d6b21
1 changed files with 0 additions and 8 deletions
|
@ -126,19 +126,11 @@ router.post('/:message_id/delete', checkAuth, async (req, res) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const channel = await getChannel(connection, message[0].channel_name);
|
const channel = await getChannel(connection, message[0].channel_name);
|
||||||
|
|
||||||
if (user.id !== channel[0].owner_id && user.id !== message[0].user_id && user.admin !== 1) {
|
if (user.id !== channel[0].owner_id && user.id !== message[0].user_id && user.admin !== 1) {
|
||||||
connection.end();
|
connection.end();
|
||||||
return res.status(401).send({ error: 'Unauthorized' });
|
return res.status(401).send({ error: 'Unauthorized' });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message[0].reply_to_id) {
|
|
||||||
const replies = await getMessageReplies(connection, message[0].reply_to_id);
|
|
||||||
if (replies.length === 1) {
|
|
||||||
await setHasReplies(connection, replyToId, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await deleteMessage(connection, message_id);
|
await deleteMessage(connection, message_id);
|
||||||
connection.end();
|
connection.end();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue