• Модуль: messageservice
  • Путь к файлу: ~/bitrix/modules/messageservice/lib/restservice.php
  • Класс: BitrixMessageServiceRestService
  • Вызов: RestService::getMessageStatus
static function getMessageStatus(array $params, int $n, CRestServer $server)
{
	if (Loader::includeModule('intranet') && BitrixIntranetUtil::isExtranetUser(static::getUserId()))
	{
		throw new AccessException("Extranet user denied access");
	}

	$params = array_change_key_case($params, CASE_UPPER);

	if (empty($params['MESSAGE_ID']) || !is_numeric($params['MESSAGE_ID']))
	{
		throw new RestException('Message not found!', self::ERROR_MESSAGE_NOT_FOUND);
	}

	$message = Message::loadById($params['MESSAGE_ID']);

	if ($message === null)
	{
		throw new RestException('Message not found!', self::ERROR_MESSAGE_NOT_FOUND);
	}

	$statusList = MessageStatus::getDescriptions('en');

	return array_key_exists($message->getStatusId(), $statusList) ? $statusList[$message->getStatusId()] : '';
}