Throw NotFoundException if results are empty in api_users_lookup
This commit is contained in:
parent
e11190b4cf
commit
a817a1a070
|
@ -1494,15 +1494,23 @@ api_register_func('api/users/search', 'api_users_search');
|
||||||
*
|
*
|
||||||
* @return array|string
|
* @return array|string
|
||||||
* @throws UnauthorizedException
|
* @throws UnauthorizedException
|
||||||
|
* @throws NotFoundException
|
||||||
*/
|
*/
|
||||||
function api_users_lookup($type)
|
function api_users_lookup($type)
|
||||||
{
|
{
|
||||||
$users = array();
|
$users = array();
|
||||||
|
|
||||||
|
if (x($_REQUEST['user_id'])) {
|
||||||
foreach (explode(',', $_REQUEST['user_id']) as $id) {
|
foreach (explode(',', $_REQUEST['user_id']) as $id) {
|
||||||
if (!empty($id)) {
|
if (!empty($id)) {
|
||||||
$users[] = api_get_user(get_app(), $id);
|
$users[] = api_get_user(get_app(), $id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($users)) {
|
||||||
|
throw new NotFoundException;
|
||||||
|
}
|
||||||
|
|
||||||
return api_format_data("users", $type, array('users' => $users));
|
return api_format_data("users", $type, array('users' => $users));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue