- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/internals/notification/usecase/commentcreated.php
- Класс: BitrixTasksInternalsNotificationUseCaseCommentCreated
- Вызов: CommentCreated::execute
public function execute(int $commentId, string $text): bool
{
$currentLoggedInUserId = BitrixMainEngineCurrentUser::get()->getId();
if ($currentLoggedInUserId === null)
{
return false;
}
$sender = $this->userRepository->getUserById($currentLoggedInUserId);
if (!$sender)
{
return false;
}
$recepients = $this->userRepository->getRecepients($this->task, $sender);
if (empty($recepients))
{
return false;
}
foreach ($this->providers as $provider)
{
foreach ($recepients as $recepient)
{
$provider->addMessage(new Message(
$sender,
$recepient,
new Metadata(
EntityCode::CODE_COMMENT,
EntityOperation::ADD,
[
'task' => $this->task,
'comment_id' => $commentId,
'text' => $text
]
)
));
}
$this->buffer->addProvider($provider);
}
return true;
}