diff --git a/back/methods/chat/notifyIssues.js b/back/methods/chat/notifyIssues.js index ef3c2cf1f..b0a42b7be 100644 --- a/back/methods/chat/notifyIssues.js +++ b/back/methods/chat/notifyIssues.js @@ -21,7 +21,10 @@ module.exports = Self => { JOIN ost_user_account ua ON t.user_id = ua.user_id JOIN ost_ticket__cdata td ON t.ticket_id = td.ticket_id JOIN ost_ticket_priority tp ON td.priority = tp.priority_id - WHERE tp.priority = 'emergency' AND t.staff_id = 0 + LEFT JOIN ost_department dept ON dept.id = t.dept_id + WHERE tp.priority = 'emergency' + AND (t.staff_id = 0 AND t.team_id = 0) + AND dept.code = 'IT' `); if (!tickets.length) return; diff --git a/back/methods/chat/spec/notifyIssue.spec.js b/back/methods/chat/spec/notifyIssue.spec.js index 9e8ac9e52..96117c2c0 100644 --- a/back/methods/chat/spec/notifyIssue.spec.js +++ b/back/methods/chat/spec/notifyIssue.spec.js @@ -27,7 +27,7 @@ describe('Chat notifyIssue()', () => { username: 'batman', subject: 'Issue title'} ]); - const expectedMessage = `@all ➔ There's a new urgent ticket:\r\n[ID: *00001* - Issue title (@batman)](https://osticket.verdnatura.es/scp/tickets.php?id=1)`; + const expectedMessage = `@all ➔ There's a new urgent ticket:\r\n[ID: *00001* - Issue title (@batman)](https://cau.verdnatura.es/scp/tickets.php?id=1)`; const department = await app.models.Department.findById(departmentId); let orgChatName = department.chatName;