• Модуль: blog
  • Путь к файлу: ~/bitrix/modules/blog/lib/integration/socialnetwork/contentviewhandler.php
  • Класс: BitrixBlogIntegrationSocialnetworkContentViewHandler
  • Вызов: ContentViewHandler::onContentViewed
static function onContentViewed(BitrixMainEvent $event)
{
	$userId = intval($event->getParameter('userId'));
	$contentTypeId = $event->getParameter('typeId');
	$contentEntityId = intval($event->getParameter('entityId'));

	if (
		$userId <= 0
		|| !in_array($contentTypeId, self::getContentTypeIdList())
		|| $contentEntityId <= 0
		|| !Loader::includeModule('im')
	)
	{
		return false;
	}

	$subTagList = array();

	if ($contentTypeId == self::CONTENT_TYPE_ID_POST)
	{
		$subTagList[] = "BLOG|POST|".$contentEntityId.'|'.$userId;
		$subTagList[] = "BLOG|POST_MENTION|".$contentEntityId.'|'.$userId;
	}
	elseif ($contentTypeId == self::CONTENT_TYPE_ID_COMMENT)
	{
		$subTagList[] = "BLOG|COMMENT|".$contentEntityId.'|'.$userId;
		$subTagList[] = "BLOG|COMMENT_MENTION|".$contentEntityId.'|'.$userId;
	}

	if (!empty($subTagList))
	{
		$CIMNotify = new CIMNotify();
		$CIMNotify->MarkNotifyReadBySubTag($subTagList);
	}

	return true;
}