diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 7e74a69804..5a4ee2fcf1 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -26,6 +26,10 @@ module.exports = Self => { Self.sendCheckingPresence = async(ctx, workerId, message) => { const models = Self.app.models; const account = await models.Account.findById(workerId); + const userId = ctx.req.accessToken.userId; + + if (!account) + throw new Error(`Could not send message to worker id ${workerId} from user ${userId}`); const query = `SELECT worker_isWorking(?) isWorking`; const [result] = await Self.rawSql(query, [workerId]);