forked from GNUsocial/gnu-social
Less redundant code, please
This commit is contained in:
parent
29620619b5
commit
fde3b99e8e
@ -172,21 +172,12 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
|||||||
*/
|
*/
|
||||||
function getNotices()
|
function getNotices()
|
||||||
{
|
{
|
||||||
$notices = array();
|
$notice = Notice_tag::getStream($this->tag)->getNotices(($this->page - 1) * $this->count,
|
||||||
|
|
||||||
$notice = Notice_tag::getStream(
|
|
||||||
$this->tag,
|
|
||||||
($this->page - 1) * $this->count,
|
|
||||||
$this->count + 1,
|
$this->count + 1,
|
||||||
$this->since_id,
|
$this->since_id,
|
||||||
$this->max_id
|
$this->max_id);
|
||||||
);
|
|
||||||
|
|
||||||
while ($notice->fetch()) {
|
return $notice->fetchAll();
|
||||||
$notices[] = clone($notice);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $notices;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +46,8 @@ class TagAction extends ManagedAction
|
|||||||
|
|
||||||
common_set_returnto($this->selfUrl());
|
common_set_returnto($this->selfUrl());
|
||||||
|
|
||||||
$this->notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
|
$this->notice = Notice_tag::getStream($this->tag)->getNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||||
|
NOTICES_PER_PAGE + 1);
|
||||||
|
|
||||||
if($this->page > 1 && $this->notice->N == 0){
|
if($this->page > 1 && $this->notice->N == 0){
|
||||||
// TRANS: Client error when page not found (404).
|
// TRANS: Client error when page not found (404).
|
||||||
|
@ -47,12 +47,8 @@ class TagrssAction extends Rss10Action
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$notice = Notice_tag::getStream($tag->tag, 0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
|
$notice = Notice_tag::getStream($tag->tag)->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
|
||||||
while ($notice->fetch()) {
|
return $notice->fetchAll();
|
||||||
$notices[] = clone($notice);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $notices;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChannel()
|
function getChannel()
|
||||||
|
@ -56,8 +56,7 @@ class Notice_tag extends Managed_DataObject
|
|||||||
static function getStream($tag, $offset=0, $limit=20, $sinceId=0, $maxId=0)
|
static function getStream($tag, $offset=0, $limit=20, $sinceId=0, $maxId=0)
|
||||||
{
|
{
|
||||||
$stream = new TagNoticeStream($tag);
|
$stream = new TagNoticeStream($tag);
|
||||||
|
return $stream;
|
||||||
return $stream->getNotices($offset, $limit, $sinceId, $maxId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function blowCache($blowLast=false)
|
function blowCache($blowLast=false)
|
||||||
|
Loading…
Reference in New Issue
Block a user