• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/rest/controllers/viewedgroup/user.php
  • Класс: BitrixTasksRestControllersViewedGroupUser
  • Вызов: User::markAsReadAction
public function markAsReadAction($fields): ?bool
{
	$fields['GROUP_ID'] = ($fields['GROUP_ID'] ?? null);
	$fields['ROLE'] = ($fields['ROLE'] ?? null);

	if (CommentsViewedGroup::isOn())
	{
		$r = (new CommentsViewedGroup())->markAsRead(
			$fields['GROUP_ID'],
			$fields['ROLE'],
			CommentsViewedEnum::resolveTypeById(CommentsViewedEnum::USER)
		);

		if ($r->isSuccess() === false)
		{
			$this->addErrors($r->getErrors());
			return null;
		}

		$params = CommentsViewedEvent::prepare($fields);
		CommentsViewedEvent::addByTypeCounterService(CommentsViewedEnum::USER,  $params);
		CommentsViewedEvent::addByTypePushService(CommentsViewedEnum::USER, $params);

		return true;
	}

	return $this->forward(
		new Comment(),
		'readAll',
		[
			'groupId' => $fields['GROUP_ID'],
			'userId' => $fields['USER_ID'],
			'role' => $fields['ROLE'],
		]
	);
}