]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
Tidying up getUser calls to profiles and some events
[quix0rs-gnu-social.git] / classes / Notice.php
index 7b87e394ce08bd3f51d5adee867f40a69c56dac7..1aba98b7bc8aca41d067e52ce55d9ba4e1a228e2 100644 (file)
@@ -522,14 +522,16 @@ class Notice extends Managed_DataObject
 
         // For private streams
 
-        $user = $profile->getUser();
+        try {
+            $user = $profile->getUser();
 
-        if (!empty($user)) {
             if ($user->private_stream &&
                 ($notice->scope == Notice::PUBLIC_SCOPE ||
                  $notice->scope == Notice::SITE_SCOPE)) {
                 $notice->scope |= Notice::FOLLOWER_SCOPE;
             }
+        } catch (NoSuchUserException $e) {
+            // Cannot handle private streams for remote profiles
         }
 
         // Force the scope for private groups
@@ -2420,11 +2422,8 @@ class Notice extends Managed_DataObject
 
             // Only for users on this site
 
-            if ($scope & Notice::SITE_SCOPE) {
-                $user = $profile->getUser();
-                if (empty($user)) {
-                    return false;
-                }
+            if (($scope & Notice::SITE_SCOPE) && !$profile->isLocal()) {
+                return false;
             }
 
             // Only for users mentioned in the notice