fix: show access denied instead of internal error

when user doesn't have access to chats
This commit is contained in:
Barış Soner Uşaklı
2023-08-18 21:40:39 -04:00
parent cbc092be1e
commit 7dd143e1f8

View File

@@ -20,7 +20,7 @@ chatsController.get = async function (req, res, next) {
}
const canChat = await privileges.global.can('chat', req.uid);
if (!canChat) {
return next(new Error('[[error:no-privileges]]'));
return helpers.notAllowed(req, res, '[[error:no-privileges]]');
}
const payload = {