declared "next_id" used to set the max_id for next link

This commit is contained in:
Mikael Nordfeldth 2014-08-08 11:35:38 +02:00
parent 8825aef1de
commit 9a192473d5

View File

@ -59,6 +59,8 @@ class ApiTimelineUserAction extends ApiBareAuthAction
{ {
var $notices = null; var $notices = null;
var $next_id = null;
/** /**
* Take arguments for running * Take arguments for running
* *
@ -126,10 +128,12 @@ class ApiTimelineUserAction extends ApiBareAuthAction
// paging links // paging links
$nextUrl = common_local_url('ApiTimelineUser', $nextUrl = !empty($this->next_id)
? common_local_url('ApiTimelineUser',
array('format' => $this->format, array('format' => $this->format,
'id' => $this->target->id), 'id' => $this->target->id),
array('max_id' => $this->next_id)); array('max_id' => $this->next_id))
: null;
$lastNotice = $this->notices[0]; $lastNotice = $this->notices[0];
$lastId = $lastNotice->id; $lastId = $lastNotice->id;
$prevUrl = common_local_url('ApiTimelineUser', $prevUrl = common_local_url('ApiTimelineUser',
@ -166,22 +170,18 @@ class ApiTimelineUserAction extends ApiBareAuthAction
// change too quickly! // change too quickly!
if (!empty($this->next_id)) { if (!empty($this->next_id)) {
$atom->addLink($nextUrl, $atom->addLink($nextUrl,
array('rel' => 'next', array('rel' => 'next',
'type' => 'application/atom+xml')); 'type' => 'application/atom+xml'));
} }
if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) { if (($this->page > 1 || !empty($this->max_id)) && !empty($this->notices)) {
$atom->addLink($prevUrl, $atom->addLink($prevUrl,
array('rel' => 'prev', array('rel' => 'prev',
'type' => 'application/atom+xml')); 'type' => 'application/atom+xml'));
} }
if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) { if ($this->page > 1 || !empty($this->since_id) || !empty($this->max_id)) {
$atom->addLink($firstUrl, $atom->addLink($firstUrl,
array('rel' => 'first', array('rel' => 'first',
'type' => 'application/atom+xml')); 'type' => 'application/atom+xml'));