| @@ -4,11 +4,9 @@ | ||
| 4 | 4 | |
| 5 | 5 | class MentionParser |
| 6 | 6 | { |
| 7 | 7 | /** |
| 8 | - * Extract agent IDs from message content. | |
| 9 | - * | |
| 10 | - * Handles two mention formats: | |
| 8 | + * Agent IDs mentioned in the content, in either format: | |
| 11 | 9 | * - Rich editor: <span class="fs_agent_mention" data-mention-username="7"> |
| 12 | 10 | * - Plain-text editor: @[7:Display Name] |
| 13 | 11 | * |
| 14 | 12 | * @param string $content |
| @@ -23,9 +21,8 @@ | ||
| 23 | 21 | } |
| 24 | 22 | |
| 25 | 23 | $ids = []; |
| 26 | 24 | |
| 27 | - // Rich editor — span with numeric data-mention-username. | |
| 28 | 25 | if (stripos($content, 'data-mention-username') !== false) { |
| 29 | 26 | preg_match_all( |
| 30 | 27 | '/<span\b[^>]*\bclass=["\'][^"\']*\bfs_agent_mention\b[^"\']*["\'][^>]*\bdata-mention-username=["\'](\d+)["\'][^>]*>/i', |
| 31 | 28 | $content, |
| @@ -36,9 +33,8 @@ | ||
| 36 | 33 | $ids[] = (int) $id; |
| 37 | 34 | } |
| 38 | 35 | } |
| 39 | 36 | |
| 40 | - // Plain-text editor — @[agentId:Display Name] token. | |
| 41 | 37 | if (strpos($content, '@[') !== false) { |
| 42 | 38 | preg_match_all('/@\[(\d+):[^\]]+\]/', $content, $tokenMatches); |
| 43 | 39 | |
| 44 | 40 | foreach ($tokenMatches[1] ?? [] as $id) { |