Hide posts from users with private_stream in scoping streams

For example the public timeline would show notices from a user with
private_stream configured. (previously it would only hide _new_ notices
by this user as they would be the only ones with notice scoping set).
This commit is contained in:
Mikael Nordfeldth 2015-02-24 22:59:58 +01:00
parent 060dbe1b56
commit ce91f1c0e6
3 changed files with 17 additions and 12 deletions

View File

@ -2676,7 +2676,7 @@ class Notice extends Managed_DataObject
$scope = self::defaultScope(); $scope = self::defaultScope();
} }
if ($scope == 0) { // Not scoping, so it is public. if ($scope == 0 && !$this->getProfile()->isPrivateStream()) { // Not scoping, so it is public.
return !$this->isHiddenSpam($profile); return !$this->isHiddenSpam($profile);
} }
@ -2727,18 +2727,9 @@ class Notice extends Managed_DataObject
} }
} }
// Only for followers of the author if ($scope & Notice::FOLLOWER_SCOPE || $this->getProfile()->isPrivateStream()) {
$author = null;
if ($scope & Notice::FOLLOWER_SCOPE) { if (!Subscription::exists($profile, $this->getProfile())) {
try {
$author = $this->getProfile();
} catch (Exception $e) {
return false;
}
if (!Subscription::exists($profile, $author)) {
return false; return false;
} }
} }

View File

@ -1572,6 +1572,15 @@ class Profile extends Managed_DataObject
return $this->getUser()->shortenLinks($text, $always); return $this->getUser()->shortenLinks($text, $always);
} }
public function isPrivateStream()
{
// We only know of public remote users as of yet...
if (!$this->isLocal()) {
return false;
}
return $this->getUser()->private_stream ? true : false;
}
public function delPref($namespace, $topic) { public function delPref($namespace, $topic) {
return Profile_prefs::setData($this, $namespace, $topic, null); return Profile_prefs::setData($this, $namespace, $topic, null);
} }

View File

@ -992,6 +992,11 @@ class User extends Managed_DataObject
return $act; return $act;
} }
public function isPrivateStream()
{
return $this->getProfile()->isPrivateStream();
}
public function delPref($namespace, $topic) public function delPref($namespace, $topic)
{ {
return $this->getProfile()->delPref($namespace, $topic); return $this->getProfile()->delPref($namespace, $topic);