diff --git a/mod/display.php b/mod/display.php index 874e2e8bf3..8d13db46ff 100644 --- a/mod/display.php +++ b/mod/display.php @@ -53,11 +53,17 @@ function display_init(App $a) if (DBA::isResult($item)) { $nick = $a->user["nickname"]; } + } + // Is this item private but could be visible to the remove visitor? - } elseif (Session::getRemoteContactID($item['uid'])) { + if (!DBA::isResult($item) && remote_user()) { $item = Item::selectFirst($fields, ['guid' => $a->argv[1], 'private' => 1]); if (DBA::isResult($item)) { - $item_user = $item['uid']; + if (!Contact::isFollower(remote_user(), $item['uid'])) { + $item = null; + } else { + $item_user = $item['uid']; + } } } @@ -81,10 +87,6 @@ function display_init(App $a) displayShowFeed($item['id'], $a->argc > 3 && $a->argv[3] == 'conversation.atom'); } - if ($a->argc >= 3 && $nick == 'feed-item') { - displayShowFeed($item['id'], $a->argc > 3 && $a->argv[3] == 'conversation.atom'); - } - if (!empty($_SERVER['HTTP_ACCEPT']) && strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) { Logger::log('Directly serving XML for id '.$item["id"], Logger::DEBUG); displayShowFeed($item["id"], false); @@ -226,9 +228,11 @@ function display_content(App $a, $update = false, $update_uid = 0) $item_parent = $item["parent"]; $item_parent_uri = $item['parent-uri']; } - } elseif (Session::getRemoteContactID($item['uid'])) { + } + + if (($item_parent == 0) && remote_user()) { $item = Item::selectFirst($fields, ['guid' => $a->argv[1], 'private' => 1]); - if (DBA::isResult($item)) { + if (DBA::isResult($item) && Contact::isFollower(remote_user(), $item['uid'])) { $item_id = $item["id"]; $item_parent = $item["parent"]; $item_parent_uri = $item['parent-uri'];