Make gateway notices available to the auth user in the API

This commit is contained in:
Zach Copley 2009-06-23 15:53:49 -07:00
parent f04a54ed2f
commit 57903bf2ac
2 changed files with 15 additions and 4 deletions

View File

@ -61,7 +61,11 @@ class TwitapifavoritesAction extends TwitterapiAction
$since_id = (int)$this->arg('since_id', 0); $since_id = (int)$this->arg('since_id', 0);
$since = $this->arg('since'); $since = $this->arg('since');
$notice = $user->favoriteNotices(($page-1)*$count, $count); if (!empty($this->auth_user) && $this->auth_user->id == $user->id) {
$notice = $user->favoriteNotices(($page-1)*$count, $count, true);
} else {
$notice = $user->favoriteNotices(($page-1)*$count, $count, false);
}
switch($apidata['content-type']) { switch($apidata['content-type']) {
case 'xml': case 'xml':

View File

@ -75,8 +75,10 @@ class TwitapistatusesAction extends TwitterapiAction
{ {
parent::handle($args); parent::handle($args);
$this->auth_user = $apidata['user'];
$user = $this->get_user($apidata['api_arg'], $apidata); $user = $this->get_user($apidata['api_arg'], $apidata);
$this->auth_user = $user;
common_debug("auth user = " . $this->auth_user->nickname);
if (empty($user)) { if (empty($user)) {
$this->clientError(_('No such user!'), 404, $this->clientError(_('No such user!'), 404,
@ -100,8 +102,13 @@ class TwitapistatusesAction extends TwitterapiAction
$since_id = (int)$this->arg('since_id', 0); $since_id = (int)$this->arg('since_id', 0);
$since = $this->arg('since'); $since = $this->arg('since');
if (!empty($this->auth_user) && $this->auth_user->id == $user->id) {
$notice = $user->noticeInbox(($page-1)*$count,
$count, $since_id, $max_id, $since);
} else {
$notice = $user->noticesWithFriends(($page-1)*$count, $notice = $user->noticesWithFriends(($page-1)*$count,
$count, $since_id, $max_id, $since); $count, $since_id, $max_id, $since);
}
switch($apidata['content-type']) { switch($apidata['content-type']) {
case 'xml': case 'xml':