]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Check if we're the current user before retrieving
authorMartin Lyth <bsfmartini@gmail.com>
Sat, 2 Jul 2016 21:02:37 +0000 (17:02 -0400)
committerMartin Lyth <bsfmartini@gmail.com>
Sat, 2 Jul 2016 21:02:37 +0000 (17:02 -0400)
classes/Profile.php

index ef3f5c1b2fdec565a321eb000d3e81653cf0e722..b557e3088c51761822bbb5bd8905101b87b43527 100644 (file)
@@ -89,13 +89,14 @@ class Profile extends Managed_DataObject
     public function getUser()
     {
         if (!isset($this->_user[$this->id])) {
-            $user = User::getKV('id', $this->id);
-            if (!$user instanceof User) {
-                throw new NoSuchUserException(array('id'=>$this->id));
-            }
             $cur_user = common_current_user();
             if (($cur_user instanceof User) && $cur_user->sameAS($this)) {
                 $user = $cur_user;
+            } else {
+                $user = User::getKV('id', $this->id);
+                if (!$user instanceof User) {
+                    throw new NoSuchUserException(array('id'=>$this->id));
+                }
             }
             $this->_user[$this->id] = $user;
         }