Throw not found exception when photo item doesn't exist in prepare_photo_data()
- Addresses part of https://github.com/friendica/friendica/issues/8000#issuecomment-573883153
This commit is contained in:
parent
9475383c4f
commit
dde2cf6ac0
1 changed files with 3 additions and 2 deletions
|
@ -311,9 +311,7 @@ function api_call(App $a, App\Arguments $args = null)
|
||||||
}
|
}
|
||||||
|
|
||||||
$called_api = explode("/", $p);
|
$called_api = explode("/", $p);
|
||||||
//unset($_SERVER['PHP_AUTH_USER']);
|
|
||||||
|
|
||||||
/// @TODO should be "true ==[=] $info['auth']", if you miss only one = character, you assign a variable (only with ==). Let's make all this even.
|
|
||||||
if (!empty($info['auth']) && api_user() === false) {
|
if (!empty($info['auth']) && api_user() === false) {
|
||||||
api_login($a);
|
api_login($a);
|
||||||
}
|
}
|
||||||
|
@ -5027,6 +5025,9 @@ function prepare_photo_data($type, $scale, $photo_id)
|
||||||
// retrieve item element for getting activities (like, dislike etc.) related to photo
|
// retrieve item element for getting activities (like, dislike etc.) related to photo
|
||||||
$condition = ['uid' => local_user(), 'resource-id' => $photo_id, 'type' => 'photo'];
|
$condition = ['uid' => local_user(), 'resource-id' => $photo_id, 'type' => 'photo'];
|
||||||
$item = Item::selectFirstForUser(local_user(), ['id'], $condition);
|
$item = Item::selectFirstForUser(local_user(), ['id'], $condition);
|
||||||
|
if (!DBA::isResult($item)) {
|
||||||
|
throw new NotFoundException('Photo-related item not found.');
|
||||||
|
}
|
||||||
|
|
||||||
$data['photo']['friendica_activities'] = api_format_items_activities($item, $type);
|
$data['photo']['friendica_activities'] = api_format_items_activities($item, $type);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue