Paging fix for public timeline: drop replies from the stuff we pull in for the threaded web view.
This commit is contained in:
parent
18a994d105
commit
880661de4e
|
@ -85,8 +85,11 @@ class PublicAction extends Action
|
||||||
|
|
||||||
common_set_returnto($this->selfUrl());
|
common_set_returnto($this->selfUrl());
|
||||||
|
|
||||||
$this->notice = Notice::publicStream(($this->page-1)*NOTICES_PER_PAGE,
|
$stream = new PublicNoticeStream(PublicNoticeStream::THREADED);
|
||||||
NOTICES_PER_PAGE + 1);
|
$this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE,
|
||||||
|
NOTICES_PER_PAGE + 1,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
|
||||||
if (!$this->notice) {
|
if (!$this->notice) {
|
||||||
// TRANS: Server error displayed when a public timeline cannot be retrieved.
|
// TRANS: Server error displayed when a public timeline cannot be retrieved.
|
||||||
|
|
|
@ -47,10 +47,16 @@ if (!defined('STATUSNET')) {
|
||||||
|
|
||||||
class PublicNoticeStream extends ScopingNoticeStream
|
class PublicNoticeStream extends ScopingNoticeStream
|
||||||
{
|
{
|
||||||
function __construct()
|
const THREADED=true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param boolean $threaded set to true to exclude replies, for later fetching
|
||||||
|
*/
|
||||||
|
function __construct($threaded=false)
|
||||||
{
|
{
|
||||||
parent::__construct(new CachingNoticeStream(new RawPublicNoticeStream(),
|
parent::__construct(new CachingNoticeStream(new RawPublicNoticeStream($threaded),
|
||||||
'public'));
|
$threaded ? 'public:threaded' : 'public'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +73,13 @@ class PublicNoticeStream extends ScopingNoticeStream
|
||||||
|
|
||||||
class RawPublicNoticeStream extends NoticeStream
|
class RawPublicNoticeStream extends NoticeStream
|
||||||
{
|
{
|
||||||
|
var $threaded;
|
||||||
|
|
||||||
|
function __construct($threaded=false)
|
||||||
|
{
|
||||||
|
$this->threaded = $threaded;
|
||||||
|
}
|
||||||
|
|
||||||
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
function getNoticeIds($offset, $limit, $since_id, $max_id)
|
||||||
{
|
{
|
||||||
$notice = new Notice();
|
$notice = new Notice();
|
||||||
|
@ -87,6 +100,9 @@ class RawPublicNoticeStream extends NoticeStream
|
||||||
$notice->whereAdd('is_local !='. Notice::LOCAL_NONPUBLIC);
|
$notice->whereAdd('is_local !='. Notice::LOCAL_NONPUBLIC);
|
||||||
$notice->whereAdd('is_local !='. Notice::GATEWAY);
|
$notice->whereAdd('is_local !='. Notice::GATEWAY);
|
||||||
}
|
}
|
||||||
|
if ($this->threaded) {
|
||||||
|
$notice->whereAdd('reply_to IS NULL');
|
||||||
|
}
|
||||||
|
|
||||||
Notice::addWhereSinceId($notice, $since_id);
|
Notice::addWhereSinceId($notice, $since_id);
|
||||||
Notice::addWhereMaxId($notice, $max_id);
|
Notice::addWhereMaxId($notice, $max_id);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user