]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/apistatusesupdate.php
Fix inconsistent title case in page title
[quix0rs-gnu-social.git] / actions / apistatusesupdate.php
index dabbea92f5246c747b913a16bd70a8c3308c7a9d..f8bf7cf874d0a811b2e600030cd57d4f173b4d19 100644 (file)
@@ -85,6 +85,11 @@ class ApiStatusesUpdateAction extends ApiAuthAction
         $this->lat    = $this->trimmed('lat');
         $this->lon    = $this->trimmed('long');
 
+        // try to set the source attr from OAuth app
+        if (empty($this->source)) {
+            $this->source = $this->oauth_source;
+        }
+
         if (empty($this->source) || in_array($this->source, self::$reserved_sources)) {
             $this->source = 'api';
         }
@@ -203,12 +208,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 +234,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 =