Check for parent existence in mod/display
- Addresses https://github.com/friendica/friendica/issues/7677#issuecomment-566079001
This commit is contained in:
parent
2fbfae0ce5
commit
bba8f03296
1 changed files with 14 additions and 9 deletions
|
@ -93,7 +93,8 @@ function display_init(App $a)
|
|||
}
|
||||
|
||||
if ($item["id"] != $item["parent"]) {
|
||||
$item = Item::selectFirstForUser($item_user, $fields, ['id' => $item["parent"]]);
|
||||
$parent = Item::selectFirstForUser($item_user, $fields, ['id' => $item["parent"]]);
|
||||
$item = $parent ?: $item;
|
||||
}
|
||||
|
||||
$profiledata = display_fetchauthor($a, $item);
|
||||
|
@ -242,8 +243,11 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
$is_remote_contact = false;
|
||||
$item_uid = local_user();
|
||||
|
||||
if (isset($item_parent_uri)) {
|
||||
$parent = null;
|
||||
if (!empty($item_parent_uri)) {
|
||||
$parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
|
||||
}
|
||||
|
||||
if (DBA::isResult($parent)) {
|
||||
$a->profile['uid'] = ($a->profile['uid'] ?? 0) ?: $parent['uid'];
|
||||
$a->profile['profile_uid'] = ($a->profile['profile_uid'] ?? 0) ?: $parent['uid'];
|
||||
|
@ -251,7 +255,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
|||
if ($is_remote_contact) {
|
||||
$item_uid = $parent['uid'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$a->profile = ['uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])];
|
||||
}
|
||||
|
||||
$page_contact = DBA::selectFirst('contact', [], ['self' => true, 'uid' => $a->profile['uid']]);
|
||||
|
|
Loading…
Reference in a new issue