Merge pull request #10843 from annando/issue-10837

Issue 10837: Display the public item when the personal one does not exist
This commit is contained in:
Hypolite Petovan 2021-10-06 16:02:04 -04:00 committed by GitHub
commit ba511c3b52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,7 +173,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
if ($update) {
$uri_id = $_REQUEST['uri_id'];
$item = Post::selectFirst(['uid', 'parent-uri-id'], ['uri-id' => $uri_id, 'uid' => [0, $update_uid]]);
$item = Post::selectFirst(['uid', 'parent-uri-id'], ['uri-id' => $uri_id, 'uid' => [0, $update_uid]], ['order' => ['uid' => true]]);
if (!empty($item)) {
if ($item['uid'] != 0) {
$a->setProfileOwner($item['uid']);
@ -190,8 +190,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
$fields = ['uri-id', 'parent-uri-id', 'uid'];
if (local_user()) {
$condition = ['guid' => DI::args()->getArgv()[1], 'uid' => local_user()];
$item = Post::selectFirstForUser(local_user(), $fields, $condition);
$condition = ['guid' => DI::args()->getArgv()[1], 'uid' => [0, local_user()]];
$item = Post::selectFirstForUser(local_user(), $fields, $condition, ['order' => ['uid' => true]]);
if (DBA::isResult($item)) {
$uri_id = $item['uri-id'];
$parent_uri_id = $item['parent-uri-id'];