forked from GNUsocial/gnu-social
Ticket #1567 - API: Change before_id parameter to max_id
This commit is contained in:
parent
f66e996073
commit
eb76a3bbb3
@ -43,7 +43,7 @@ class Twitapidirect_messagesAction extends TwitterapiAction
|
|||||||
$count = $this->arg('count');
|
$count = $this->arg('count');
|
||||||
$since = $this->arg('since');
|
$since = $this->arg('since');
|
||||||
$since_id = $this->arg('since_id');
|
$since_id = $this->arg('since_id');
|
||||||
$before_id = $this->arg('before_id');
|
$max_id = $this->arg('max_id');
|
||||||
|
|
||||||
$page = $this->arg('page');
|
$page = $this->arg('page');
|
||||||
|
|
||||||
@ -74,8 +74,8 @@ class Twitapidirect_messagesAction extends TwitterapiAction
|
|||||||
$link = $server . $user->nickname . '/outbox';
|
$link = $server . $user->nickname . '/outbox';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($before_id) {
|
if ($max_id) {
|
||||||
$message->whereAdd("id < $before_id");
|
$message->whereAdd("id < $max_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($since_id) {
|
if ($since_id) {
|
||||||
|
@ -45,22 +45,21 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
|
|
||||||
$page = $this->arg('page');
|
$page = $this->arg('page');
|
||||||
$since_id = $this->arg('since_id');
|
$since_id = $this->arg('since_id');
|
||||||
$before_id = $this->arg('before_id');
|
$max_id = $this->arg('max_id');
|
||||||
|
|
||||||
// NOTE: page, since_id, and before_id are extensions to Twitter API -- TB
|
|
||||||
if (!$page) {
|
if (!$page) {
|
||||||
$page = 1;
|
$page = 1;
|
||||||
}
|
}
|
||||||
if (!$since_id) {
|
if (!$since_id) {
|
||||||
$since_id = 0;
|
$since_id = 0;
|
||||||
}
|
}
|
||||||
if (!$before_id) {
|
if (!$max_id) {
|
||||||
$before_id = 0;
|
$max_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$since = strtotime($this->arg('since'));
|
$since = strtotime($this->arg('since'));
|
||||||
|
|
||||||
$notice = Notice::publicStream((($page-1)*$MAX_PUBSTATUSES), $MAX_PUBSTATUSES, $since_id, $before_id, $since);
|
$notice = Notice::publicStream((($page-1)*$MAX_PUBSTATUSES), $MAX_PUBSTATUSES, $since_id, $max_id, $since);
|
||||||
|
|
||||||
if ($notice) {
|
if ($notice) {
|
||||||
|
|
||||||
@ -97,7 +96,7 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
$since_id = $this->arg('since_id');
|
$since_id = $this->arg('since_id');
|
||||||
$count = $this->arg('count');
|
$count = $this->arg('count');
|
||||||
$page = $this->arg('page');
|
$page = $this->arg('page');
|
||||||
$before_id = $this->arg('before_id');
|
$max_id = $this->arg('max_id');
|
||||||
|
|
||||||
if (!$page) {
|
if (!$page) {
|
||||||
$page = 1;
|
$page = 1;
|
||||||
@ -111,9 +110,8 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
$since_id = 0;
|
$since_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: before_id is an extension to Twitter API -- TB
|
if (!$max_id) {
|
||||||
if (!$before_id) {
|
$max_id = 0;
|
||||||
$before_id = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$since = strtotime($this->arg('since'));
|
$since = strtotime($this->arg('since'));
|
||||||
@ -133,7 +131,7 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
$link = common_local_url('all', array('nickname' => $user->nickname));
|
$link = common_local_url('all', array('nickname' => $user->nickname));
|
||||||
$subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $user->nickname, $sitename);
|
$subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $user->nickname, $sitename);
|
||||||
|
|
||||||
$notice = $user->noticesWithFriends(($page-1)*20, $count, $since_id, $before_id, $since);
|
$notice = $user->noticesWithFriends(($page-1)*20, $count, $since_id, $max_id, $since);
|
||||||
|
|
||||||
switch($apidata['content-type']) {
|
switch($apidata['content-type']) {
|
||||||
case 'xml':
|
case 'xml':
|
||||||
@ -184,7 +182,7 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
$since = $this->arg('since');
|
$since = $this->arg('since');
|
||||||
$since_id = $this->arg('since_id');
|
$since_id = $this->arg('since_id');
|
||||||
$page = $this->arg('page');
|
$page = $this->arg('page');
|
||||||
$before_id = $this->arg('before_id');
|
$max_id = $this->arg('max_id');
|
||||||
|
|
||||||
if (!$page) {
|
if (!$page) {
|
||||||
$page = 1;
|
$page = 1;
|
||||||
@ -198,9 +196,8 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
$since_id = 0;
|
$since_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: before_id is an extensions to Twitter API -- TB
|
if (!$max_id) {
|
||||||
if (!$before_id) {
|
$max_id = 0;
|
||||||
$before_id = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$since = strtotime($this->arg('since'));
|
$since = strtotime($this->arg('since'));
|
||||||
@ -220,7 +217,7 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
|
|
||||||
# XXX: since
|
# XXX: since
|
||||||
|
|
||||||
$notice = $user->getNotices((($page-1)*20), $count, $since_id, $before_id, $since);
|
$notice = $user->getNotices((($page-1)*20), $count, $since_id, $max_id, $since);
|
||||||
|
|
||||||
switch($apidata['content-type']) {
|
switch($apidata['content-type']) {
|
||||||
case 'xml':
|
case 'xml':
|
||||||
@ -353,7 +350,7 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
$count = $this->arg('count');
|
$count = $this->arg('count');
|
||||||
$page = $this->arg('page');
|
$page = $this->arg('page');
|
||||||
$since_id = $this->arg('since_id');
|
$since_id = $this->arg('since_id');
|
||||||
$before_id = $this->arg('before_id');
|
$max_id = $this->arg('max_id');
|
||||||
|
|
||||||
$user = $this->get_user($apidata['api_arg'], $apidata);
|
$user = $this->get_user($apidata['api_arg'], $apidata);
|
||||||
$this->auth_user = $apidata['user'];
|
$this->auth_user = $apidata['user'];
|
||||||
@ -380,15 +377,14 @@ class TwitapistatusesAction extends TwitterapiAction
|
|||||||
$since_id = 0;
|
$since_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: before_id is an extension to Twitter API -- TB
|
if (!$max_id) {
|
||||||
if (!$before_id) {
|
$max_id = 0;
|
||||||
$before_id = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$since = strtotime($this->arg('since'));
|
$since = strtotime($this->arg('since'));
|
||||||
|
|
||||||
$notice = $user->getReplies((($page-1)*20),
|
$notice = $user->getReplies((($page-1)*20),
|
||||||
$count, $since_id, $before_id, $since);
|
$count, $since_id, $max_id, $since);
|
||||||
$notices = array();
|
$notices = array();
|
||||||
|
|
||||||
while ($notice->fetch()) {
|
while ($notice->fetch()) {
|
||||||
|
@ -46,7 +46,7 @@ class Fave extends Memcached_DataObject
|
|||||||
return $ids;
|
return $ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _streamDirect($user_id, $offset, $limit, $since_id, $before_id, $since)
|
function _streamDirect($user_id, $offset, $limit, $since_id, $max_id, $since)
|
||||||
{
|
{
|
||||||
$fav = new Fave();
|
$fav = new Fave();
|
||||||
|
|
||||||
@ -59,8 +59,8 @@ class Fave extends Memcached_DataObject
|
|||||||
$fav->whereAdd('notice_id > ' . $since_id);
|
$fav->whereAdd('notice_id > ' . $since_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($before_id != 0) {
|
if ($max_id != 0) {
|
||||||
$fav->whereAdd('notice_id < ' . $before_id);
|
$fav->whereAdd('notice_id < ' . $max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($since)) {
|
if (!is_null($since)) {
|
||||||
|
@ -43,15 +43,15 @@ class Notice_inbox extends Memcached_DataObject
|
|||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
function stream($user_id, $offset, $limit, $since_id, $before_id, $since)
|
function stream($user_id, $offset, $limit, $since_id, $max_id, $since)
|
||||||
{
|
{
|
||||||
return Notice::stream(array('Notice_inbox', '_streamDirect'),
|
return Notice::stream(array('Notice_inbox', '_streamDirect'),
|
||||||
array($user_id),
|
array($user_id),
|
||||||
'notice_inbox:by_user:'.$user_id,
|
'notice_inbox:by_user:'.$user_id,
|
||||||
$offset, $limit, $since_id, $before_id, $since);
|
$offset, $limit, $since_id, $max_id, $since);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _streamDirect($user_id, $offset, $limit, $since_id, $before_id, $since)
|
function _streamDirect($user_id, $offset, $limit, $since_id, $max_id, $since)
|
||||||
{
|
{
|
||||||
$inbox = new Notice_inbox();
|
$inbox = new Notice_inbox();
|
||||||
|
|
||||||
@ -61,8 +61,8 @@ class Notice_inbox extends Memcached_DataObject
|
|||||||
$inbox->whereAdd('notice_id > ' . $since_id);
|
$inbox->whereAdd('notice_id > ' . $since_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($before_id != 0) {
|
if ($max_id != 0) {
|
||||||
$inbox->whereAdd('notice_id < ' . $before_id);
|
$inbox->whereAdd('notice_id < ' . $max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($since)) {
|
if (!is_null($since)) {
|
||||||
|
@ -46,7 +46,7 @@ class Notice_tag extends Memcached_DataObject
|
|||||||
return Notice::getStreamByIds($ids);
|
return Notice::getStreamByIds($ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _streamDirect($tag, $offset, $limit, $since_id, $before_id, $since)
|
function _streamDirect($tag, $offset, $limit, $since_id, $max_id, $since)
|
||||||
{
|
{
|
||||||
$nt = new Notice_tag();
|
$nt = new Notice_tag();
|
||||||
|
|
||||||
@ -59,8 +59,8 @@ class Notice_tag extends Memcached_DataObject
|
|||||||
$nt->whereAdd('notice_id > ' . $since_id);
|
$nt->whereAdd('notice_id > ' . $since_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($before_id != 0) {
|
if ($max_id != 0) {
|
||||||
$nt->whereAdd('notice_id < ' . $before_id);
|
$nt->whereAdd('notice_id < ' . $max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($since)) {
|
if (!is_null($since)) {
|
||||||
|
@ -22,16 +22,16 @@ class Reply extends Memcached_DataObject
|
|||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0, $since=null)
|
||||||
{
|
{
|
||||||
$ids = Notice::stream(array('Reply', '_streamDirect'),
|
$ids = Notice::stream(array('Reply', '_streamDirect'),
|
||||||
array($user_id),
|
array($user_id),
|
||||||
'reply:stream:' . $user_id,
|
'reply:stream:' . $user_id,
|
||||||
$offset, $limit, $since_id, $before_id, $since);
|
$offset, $limit, $since_id, $max_id, $since);
|
||||||
return $ids;
|
return $ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _streamDirect($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
|
function _streamDirect($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $max_id=0, $since=null)
|
||||||
{
|
{
|
||||||
$reply = new Reply();
|
$reply = new Reply();
|
||||||
$reply->profile_id = $user_id;
|
$reply->profile_id = $user_id;
|
||||||
@ -40,8 +40,8 @@ class Reply extends Memcached_DataObject
|
|||||||
$reply->whereAdd('notice_id > ' . $since_id);
|
$reply->whereAdd('notice_id > ' . $since_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($before_id != 0) {
|
if ($max_id != 0) {
|
||||||
$reply->whereAdd('notice_id < ' . $before_id);
|
$reply->whereAdd('notice_id < ' . $max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($since)) {
|
if (!is_null($since)) {
|
||||||
|
@ -58,7 +58,7 @@ class User_group extends Memcached_DataObject
|
|||||||
return Notice::getStreamByIds($ids);
|
return Notice::getStreamByIds($ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _streamDirect($offset, $limit, $since_id, $before_id, $since)
|
function _streamDirect($offset, $limit, $since_id, $max_id, $since)
|
||||||
{
|
{
|
||||||
$inbox = new Group_inbox();
|
$inbox = new Group_inbox();
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ class User_group extends Memcached_DataObject
|
|||||||
$inbox->whereAdd('notice_id > ' . $since_id);
|
$inbox->whereAdd('notice_id > ' . $since_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($before_id != 0) {
|
if ($max_id != 0) {
|
||||||
$inbox->whereAdd('notice_id < ' . $before_id);
|
$inbox->whereAdd('notice_id < ' . $max_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($since)) {
|
if (!is_null($since)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user