Support undocumented 'id' parameter in /statuses/show API method
This commit is contained in:
parent
d48d27d79f
commit
d40075ae9c
@ -373,9 +373,19 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
return;
|
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'];
|
$this->auth_user = $apidata['user'];
|
||||||
$notice_id = $apidata['api_arg'];
|
$notice_id = $this->trimmed('id');
|
||||||
$notice = Notice::staticGet($notice_id);
|
|
||||||
|
if (empty($notice_id)) {
|
||||||
|
$notice_id = $apidata['api_arg'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$notice = Notice::staticGet((int)$notice_id);
|
||||||
|
|
||||||
if ($notice) {
|
if ($notice) {
|
||||||
if ($apidata['content-type'] == 'xml') {
|
if ($apidata['content-type'] == 'xml') {
|
||||||
@ -389,7 +399,6 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
$this->clientError(_('No status with that ID found.'),
|
$this->clientError(_('No status with that ID found.'),
|
||||||
404, $apidata['content-type']);
|
404, $apidata['content-type']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function destroy($args, $apidata)
|
function destroy($args, $apidata)
|
||||||
|
@ -261,7 +261,7 @@ class Router
|
|||||||
$m->connect('api/statuses/:method',
|
$m->connect('api/statuses/:method',
|
||||||
array('action' => 'api',
|
array('action' => 'api',
|
||||||
'apiaction' => 'statuses'),
|
'apiaction' => 'statuses'),
|
||||||
array('method' => '(public_timeline|friends_timeline|user_timeline|update|replies|mentions|friends|followers|featured)(\.(atom|rss|xml|json))?'));
|
array('method' => '(public_timeline|friends_timeline|user_timeline|update|replies|mentions|show|friends|followers|featured)(\.(atom|rss|xml|json))?'));
|
||||||
|
|
||||||
$m->connect('api/statuses/:method/:argument',
|
$m->connect('api/statuses/:method/:argument',
|
||||||
array('action' => 'api',
|
array('action' => 'api',
|
||||||
|
Loading…
Reference in New Issue
Block a user