Suggested edits by hannes2peer

This commit is contained in:
Mikael Nordfeldth 2015-09-03 18:04:13 +02:00
parent 84a65c7189
commit e06553b15b

View File

@ -96,21 +96,12 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
$original = clone($profile); $original = clone($profile);
if (!empty($this->name)) {
$profile->fullname = $this->name; $profile->fullname = $this->name;
}
if (!empty($this->url)) {
$profile->homepage = $this->url; $profile->homepage = $this->url;
}
if (!empty($this->description)) {
$profile->bio = $this->description; $profile->bio = $this->description;
}
if (!empty($this->location)) {
$profile->location = $this->location; $profile->location = $this->location;
if (!empty($this->location)) {
$loc = Location::fromName($this->location); $loc = Location::fromName($this->location);
if (!empty($loc)) { if (!empty($loc)) {
@ -119,6 +110,12 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
$profile->location_id = $loc->location_id; $profile->location_id = $loc->location_id;
$profile->location_ns = $loc->location_ns; $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); $result = $profile->update($original);