diff options
author | Evan Prodromou <evan@status.net> | 2009-12-28 15:13:15 -0800 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-12-28 15:59:24 -0800 |
commit | e3789be03f9e2d20aa74da1a10c4090b260d3359 (patch) | |
tree | b19e12abeb1515a260e7e5b0a6635dda6ce24d10 /actions/apistatusesupdate.php | |
parent | d96d1775d5e8613443d2e07d253b3269832c36c5 (diff) |
Move location-argument-handling code into a single function
Moved the important parts of the location-argument-handling stuff
to a single function. Handles defaults and overrides correctly, and
easy to use. Changed Web and API channels to use it.
Diffstat (limited to 'actions/apistatusesupdate.php')
-rw-r--r-- | actions/apistatusesupdate.php | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index dabbea92f..f594bbf39 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -203,12 +203,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction } } - $location = null; - - if (!empty($this->lat) && !empty($this->lon)) { - $location = Location::fromLatLon($this->lat, $this->lon); - } - $upload = null; try { @@ -235,11 +229,15 @@ class ApiStatusesUpdateAction extends ApiAuthAction $options = array('reply_to' => $reply_to); - if (!empty($location)) { - $options['lat'] = $location->lat; - $options['lon'] = $location->lon; - $options['location_id'] = $location->location_id; - $options['location_ns'] = $location->location_ns; + if ($this->user->shareLocation()) { + + $locOptions = Notice::locationOptions($this->lat, + $this->lon, + null, + null, + $this->user->getProfile()); + + $options = array_merge($options, $locOptions); } $this->notice = |