]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Reworked the ActivityContext->attention structure
[quix0rs-gnu-social.git] / classes / Profile.php
index d697536b439b957b6d99ec674622ffe75e21465b..b2dab519a1599940733f0c1a9853860db52eeb3c 100644 (file)
@@ -842,12 +842,12 @@ class Profile extends Managed_DataObject
         return ($biolimit > 0 && !empty($bio) && (mb_strlen($bio) > $biolimit));
     }
 
-    public function update($orig)
+    function update($dataObject=false)
     {
-        if ($this->nickname != $orig->nickname) {
-            $local = User::getKV('id', $this->id);
-            if ($local instanceof User) {
-                common_debug("Updating User ({$this->id}) nickname from {$orig->nickname} to {$this->nickname}");
+        if (is_object($dataObject) && $this->nickname != $dataObject->nickname) {
+            try {
+                $local = $this->getUser();
+                common_debug("Updating User ({$this->id}) nickname from {$dataObject->nickname} to {$this->nickname}");
                 $origuser = clone($local);
                 $local->nickname = $this->nickname;
                 $result = $local->updateKeys($origuser);
@@ -861,10 +861,12 @@ class Profile extends Managed_DataObject
                 if ($local->hasRole(Profile_role::OWNER)) {
                     User::blow('user:site_owner');
                 }
+            } catch (NoSuchUserException $e) {
+                // Nevermind...
             }
         }
 
-        return parent::update($orig);
+        return parent::update($dataObject);
     }
 
     function delete()