• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/im/notification/usecase/taskstatuschanged.php
  • Класс: BitrixTasksIntegrationIMNotificationUseCaseTaskStatusChanged
  • Вызов: TaskStatusChanged::getNotification
public function getNotification(Message $message): ?Notification
{
	$task = $message->getMetaData()->getTask();
	$taskCurrentStatus = $message->getMetaData()->getParams()['task_current_status'] ?? null;

	if ($task === null || $taskCurrentStatus === null)
	{
		return null;
	}

	$title = new NotificationTaskTitle($task);
	$locKey = $this->getTaskStatusMessageKey($taskCurrentStatus, $task);

	$notification = new Notification(
		$locKey,
		$message
	);

	$notification->addTemplate(
		new NotificationTemplate(
			'#TASK_TITLE#',
			$title->getFormatted($message->getRecepient()->getLang())
		)
	);

	if ($taskCurrentStatus == CTasks::STATE_DECLINED)
	{
		$notification->addTemplate(
			new NotificationTemplate(
				'#TASK_DECLINE_REASON#',
				$task->getDeclineReason()
			)
		);
	}

	return $notification;
}