From d22fc7423ce2365e229fb41e0dae97f069ec2214 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 31 Dec 2011 08:56:54 -0800 Subject: [PATCH] Hide posts by silenced users --- classes/Notice.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 9ee5696e3f..38e41d29f1 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -2381,24 +2381,34 @@ class Notice extends Managed_DataObject $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; } - // 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; } - // 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; } + // If there's scope, anon cannot be in scope + + if (empty($profile)) { + return false; + } + // Only for users on this site if ($scope & Notice::SITE_SCOPE) { @@ -2445,7 +2455,6 @@ class Notice extends Managed_DataObject // Only for followers of the author if ($scope & Notice::FOLLOWER_SCOPE) { - $author = $this->getProfile(); if (!Subscription::exists($profile, $author)) { return false; } -- 2.39.5