| @@ -97,10 +97,20 @@ | ||
| 97 | 97 | if (!$assignedAgent || empty($assignedAgent->id)) { |
| 98 | 98 | return; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | + if ((int) $ticket->agent_id !== (int) $assignedAgent->id) { | |
| 102 | + return; | |
| 103 | + } | |
| 104 | + | |
| 105 | + $accessibleAgents = $this->filterTicketAccessibleAgents([$assignedAgent], $ticket); | |
| 106 | + | |
| 107 | + if (!$accessibleAgents) { | |
| 108 | + return; | |
| 109 | + } | |
| 110 | + | |
| 101 | 111 | $assignerId = (!empty($assigner) && !empty($assigner->id)) ? (int) $assigner->id : null; |
| 102 | - $recipientIds = (new RecipientResolver())->extractRecipientPersonIds([$assignedAgent]); | |
| 112 | + $recipientIds = (new RecipientResolver())->extractRecipientPersonIds($accessibleAgents); | |
| 103 | 113 | |
| 104 | 114 | if (!$recipientIds) { |
| 105 | 115 | return; |
| 106 | 116 | } |