We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit d22fc742 authored by Evan Prodromou's avatar Evan Prodromou

Hide posts by silenced users

parent bff89bc8
...@@ -2381,24 +2381,34 @@ class Notice extends Managed_DataObject ...@@ -2381,24 +2381,34 @@ class Notice extends Managed_DataObject
$scope = self::defaultScope(); $scope = self::defaultScope();
} }
// If there's no scope, anyone (even anon) is in scope. $author = $this->getProfile();
if ($scope == 0) { // Author is always in scope
if ($author->id == $profile->id) {
return true; return true;
} }
// If there's scope, anon cannot be in scope // If the author is silenced, only show to
// folks who can un-silence; note ignores scope
if (empty($profile)) { if ($author->hasRole(Profile_role::SILENCED) &&
(empty($profile) || !$profile->hasRight(Right::SILENCEUSER))) {
return false; return false;
} }
// Author is always in scope // If there's no scope, anyone (even anon) is in scope.
if ($this->profile_id == $profile->id) { if ($scope == 0) {
return true; return true;
} }
// If there's scope, anon cannot be in scope
if (empty($profile)) {
return false;
}
// Only for users on this site // Only for users on this site
if ($scope & Notice::SITE_SCOPE) { if ($scope & Notice::SITE_SCOPE) {
...@@ -2445,7 +2455,6 @@ class Notice extends Managed_DataObject ...@@ -2445,7 +2455,6 @@ class Notice extends Managed_DataObject
// Only for followers of the author // Only for followers of the author
if ($scope & Notice::FOLLOWER_SCOPE) { if ($scope & Notice::FOLLOWER_SCOPE) {
$author = $this->getProfile();
if (!Subscription::exists($profile, $author)) { if (!Subscription::exists($profile, $author)) {
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment