Ticket #1428 - Changed replies API method to "mentions".

This commit is contained in:
Zach Copley 2009-04-28 23:31:00 -07:00
parent f8c34711b4
commit e85cddba45
2 changed files with 23 additions and 19 deletions

View File

@ -144,10 +144,10 @@ class TwitapistatusesAction extends TwitterapiAction
break; break;
case 'atom': case 'atom':
if (isset($apidata['api_arg'])) { if (isset($apidata['api_arg'])) {
$selfuri = $selfuri = common_root_url() . $selfuri = common_root_url() .
'api/statuses/friends_timeline/' . $apidata['api_arg'] . '.atom'; 'api/statuses/friends_timeline/' . $apidata['api_arg'] . '.atom';
} else { } else {
$selfuri = $selfuri = common_root_url() . $selfuri = common_root_url() .
'api/statuses/friends_timeline.atom'; 'api/statuses/friends_timeline.atom';
} }
$this->show_atom_timeline($notice, $title, $id, $link, $subtitle, null, $selfuri); $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, null, $selfuri);
@ -231,10 +231,10 @@ class TwitapistatusesAction extends TwitterapiAction
break; break;
case 'atom': case 'atom':
if (isset($apidata['api_arg'])) { if (isset($apidata['api_arg'])) {
$selfuri = $selfuri = common_root_url() . $selfuri = common_root_url() .
'api/statuses/user_timeline/' . $apidata['api_arg'] . '.atom'; 'api/statuses/user_timeline/' . $apidata['api_arg'] . '.atom';
} else { } else {
$selfuri = $selfuri = common_root_url() . $selfuri = common_root_url() .
'api/statuses/user_timeline.atom'; 'api/statuses/user_timeline.atom';
} }
$this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink, $selfuri); $this->show_atom_timeline($notice, $title, $id, $link, $subtitle, $suplink, $selfuri);
@ -344,7 +344,7 @@ class TwitapistatusesAction extends TwitterapiAction
$this->show($args, $apidata); $this->show($args, $apidata);
} }
function replies($args, $apidata) function mentions($args, $apidata)
{ {
parent::handle($args); parent::handle($args);
@ -360,11 +360,13 @@ class TwitapistatusesAction extends TwitterapiAction
$profile = $user->getProfile(); $profile = $user->getProfile();
$sitename = common_config('site', 'name'); $sitename = common_config('site', 'name');
$title = sprintf(_('%1$s / Updates replying to %2$s'), $sitename, $user->nickname); $title = sprintf(_('%1$s / Updates mentioning %2$s'),
$sitename, $user->nickname);
$taguribase = common_config('integration', 'taguri'); $taguribase = common_config('integration', 'taguri');
$id = "tag:$taguribase:Replies:".$user->id; $id = "tag:$taguribase:Mentions:".$user->id;
$link = common_local_url('replies', array('nickname' => $user->nickname)); $link = common_local_url('replies', array('nickname' => $user->nickname));
$subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'), $sitename, $user->nickname, $profile->getBestName()); $subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'),
$sitename, $user->nickname, $profile->getBestName());
if (!$page) { if (!$page) {
$page = 1; $page = 1;
@ -385,7 +387,8 @@ class TwitapistatusesAction extends TwitterapiAction
$since = strtotime($this->arg('since')); $since = strtotime($this->arg('since'));
$notice = $user->getReplies((($page-1)*20), $count, $since_id, $before_id, $since); $notice = $user->getReplies((($page-1)*20),
$count, $since_id, $before_id, $since);
$notices = array(); $notices = array();
while ($notice->fetch()) { while ($notice->fetch()) {
@ -400,14 +403,10 @@ class TwitapistatusesAction extends TwitterapiAction
$this->show_rss_timeline($notices, $title, $link, $subtitle); $this->show_rss_timeline($notices, $title, $link, $subtitle);
break; break;
case 'atom': case 'atom':
if (isset($apidata['api_arg'])) { $selfuri = common_root_url() .
$selfuri = $selfuri = common_root_url() . ltrim($_SERVER['QUERY_STRING'], 'p=');
'api/statuses/replies/' . $apidata['api_arg'] . '.atom'; $this->show_atom_timeline($notices, $title, $id, $link, $subtitle,
} else { null, $selfuri);
$selfuri = $selfuri = common_root_url() .
'api/statuses/replies.atom';
}
$this->show_atom_timeline($notices, $title, $id, $link, $subtitle, null, $selfuri);
break; break;
case 'json': case 'json':
$this->show_json_timeline($notices); $this->show_json_timeline($notices);
@ -418,6 +417,11 @@ class TwitapistatusesAction extends TwitterapiAction
} }
function replies($args, $apidata)
{
call_user_func(array($this, 'mentions'), $args, $apidata);
}
function show($args, $apidata) function show($args, $apidata)
{ {
parent::handle($args); parent::handle($args);

View File

@ -231,12 +231,12 @@ 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|friends|followers|featured)(\.(atom|rss|xml|json))?')); array('method' => '(public_timeline|friends_timeline|user_timeline|update|replies|mentions|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',
'apiaction' => 'statuses'), 'apiaction' => 'statuses'),
array('method' => '(user_timeline|friends_timeline|replies|show|destroy|friends|followers)')); array('method' => '(user_timeline|friends_timeline|replies|mentions|show|destroy|friends|followers)'));
// users // users