• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/lastsearch.php
  • Класс: BitrixImLastSearch
  • Вызов: LastSearch::delete
static function delete($dialogId, $userId = null)
{
	$userId = BitrixImCommon::getUserId($userId);
	if (!$userId)
	{
		return false;
	}

	if (!$dialogId || $dialogId == 'chat0')
	{
		return false;
	}

	if (!BitrixImCommon::isDialogId($dialogId))
	{
		return false;
	}

	$orm = BitrixImModelLastSearchTable::getList(Array(
		'filter' => Array(
			'=USER_ID' => $userId,
			'=DIALOG_ID' => $dialogId
		)
	));
	$row = $orm->fetch();
	if (!$row)
	{
		return false;
	}

	BitrixImModelLastSearchTable::delete($row['ID']);

	self::clearCache($userId);

	return true;
}