]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/twitapistatuses.php
Merge branch '0.9.x' of git@gitorious.org:laconica/mainline into 0.9.x
[quix0rs-gnu-social.git] / actions / twitapistatuses.php
index 555c746cbcae6b041369627a89cc61dc1ef721d6..e3d366ecc8dddf7f4914faafaa935d1cbfeeea86 100644 (file)
@@ -373,9 +373,19 @@ class TwitapistatusesAction extends TwitterapiAction
             return;
         }
 
+        // 'id' is an undocumented parameter in Twitter's API. Several
+        // clients make use of it, so we support it too.
+
+        // show.json?id=12345 takes precedence over /show/12345.json
+
         $this->auth_user = $apidata['user'];
-        $notice_id       = $apidata['api_arg'];
-        $notice          = Notice::staticGet($notice_id);
+        $notice_id       = $this->trimmed('id');
+
+        if (empty($notice_id)) {
+            $notice_id   = $apidata['api_arg'];
+        }
+
+        $notice          = Notice::staticGet((int)$notice_id);
 
         if ($notice) {
             if ($apidata['content-type'] == 'xml') {
@@ -386,10 +396,15 @@ class TwitapistatusesAction extends TwitterapiAction
         } else {
             // XXX: Twitter just sets a 404 header and doens't bother
             // to return an err msg
-            $this->clientError(_('No status with that ID found.'),
-                404, $apidata['content-type']);
+            $deleted = Deleted_notice::staticGet($notice_id);
+            if (!empty($deleted)) {
+                $this->clientError(_('Status deleted.'),
+                                   410, $apidata['content-type']);
+            } else {
+                $this->clientError(_('No status with that ID found.'),
+                                   404, $apidata['content-type']);
+            }
         }
-
     }
 
     function destroy($args, $apidata)