]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Suggested edits by hannes2peer
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 3 Sep 2015 16:04:13 +0000 (18:04 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 3 Sep 2015 16:04:13 +0000 (18:04 +0200)
actions/apiaccountupdateprofile.php

index a9842ec5d8f33d80dba29e353e4597be3150623c..8767dabf8528a6ef23c597bb7b4a8de47903ba8a 100644 (file)
@@ -96,21 +96,12 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
 
         $original = clone($profile);
 
-        if (!empty($this->name)) {
-            $profile->fullname = $this->name;
-        }
-
-        if (!empty($this->url)) {
-            $profile->homepage = $this->url;
-        }
-
-        if (!empty($this->description)) {
-            $profile->bio = $this->description;
-        }
+        $profile->fullname = $this->name;
+        $profile->homepage = $this->url;
+        $profile->bio = $this->description;
+        $profile->location = $this->location;
 
         if (!empty($this->location)) {
-            $profile->location = $this->location;
-
             $loc = Location::fromName($this->location);
 
             if (!empty($loc)) {
@@ -119,6 +110,12 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
                 $profile->location_id = $loc->location_id;
                 $profile->location_ns = $loc->location_ns;
             }
+        } else {
+            // location is empty so reset the extrapolated information too
+            $profile->lat = '';
+            $profile->lon = '';
+            $profile->location_id = '';
+            $profile->location_ns = '';
         }
 
         $result = $profile->update($original);