Hide stuff if there's an exception getting the profile

This commit is contained in:
Evan Prodromou 2012-05-04 23:37:12 -04:00
parent 2879f0a499
commit acf52a3041

View File

@ -2454,7 +2454,11 @@ class Notice extends Managed_DataObject
if ($scope & Notice::FOLLOWER_SCOPE) { if ($scope & Notice::FOLLOWER_SCOPE) {
$author = $this->getProfile(); try {
$author = $this->getProfile();
} catch (Exception $e) {
return false;
}
if (!Subscription::exists($profile, $author)) { if (!Subscription::exists($profile, $author)) {
return false; return false;
@ -2471,7 +2475,13 @@ class Notice extends Managed_DataObject
if (common_config('notice', 'hidespam')) { if (common_config('notice', 'hidespam')) {
$author = $this->getProfile(); try {
$author = $this->getProfile();
} catch(Exception $e) {
// If we can't get an author, keep it hidden.
// XXX: technically not spam, but, whatever.
return true;
}
if ($author->hasRole(Profile_role::SILENCED)) { if ($author->hasRole(Profile_role::SILENCED)) {
if (empty($profile) || (($profile->id !== $author->id) && (!$profile->hasRight(Right::REVIEWSPAM)))) { if (empty($profile) || (($profile->id !== $author->id) && (!$profile->hasRight(Right::REVIEWSPAM)))) {