- Модуль: ui
- Путь к файлу: ~/bitrix/modules/ui/lib/timeline/comment.php
- Класс: BitrixUITimelineComment
- Вызов: Comment::sendMentions
public function sendMentions(
int $id,
int $fromUserId,
string $text,
string $message,
array $previouslyMentionedUserIds = []
): array
{
$messageIds = [];
$parser = new CommentParser();
$mentionedUserIds = $parser->getMentionedUserIds($text);
$mentionedUserIds = array_filter(
$mentionedUserIds,
static function($userId) use ($fromUserId, $previouslyMentionedUserIds) {
$userId = (int)$userId;
return (
$userId !== $fromUserId
&& !in_array($userId, $previouslyMentionedUserIds, true)
);
}
);
if(empty($mentionedUserIds))
{
return $messageIds;
}
if(!Loader::includeModule('im'))
{
return $messageIds;
}
foreach ($mentionedUserIds as $userId)
{
$userId = (int)$userId;
$messageIds[] = CIMNotify::Add([
'TO_USER_ID' => $userId,
'FROM_USER_ID' => $fromUserId,
'NOTIFY_TYPE' => IM_NOTIFY_FROM,
'NOTIFY_MODULE' => Driver::MODULE_ID,
'NOTIFY_TAG' => 'RPA|MESSAGE_TIMELINE_MENTION|' . $id,
'NOTIFY_MESSAGE' => $message,
]);
}
return $messageIds;
}