From 951601633bdfec4da55a559c522a4d2923600b71 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 18 Sep 2011 12:33:35 -0400 Subject: [PATCH] better handling of tagged notice streams --- actions/showstream.php | 27 +++++++++++++++++++++------ lib/taggedprofilenoticestream.php | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/actions/showstream.php b/actions/showstream.php index ee8bc18e72..ccd976a0e3 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -55,6 +55,25 @@ require_once INSTALLDIR.'/lib/feedlist.php'; */ class ShowstreamAction extends ProfileAction { + var $notice; + + function prepare($args) + { + parent::prepare($args); + + $p = Profile::current(); + + if (empty($this->tag)) { + $stream = new ProfileNoticeStream($this->profile, $p); + } else { + $stream = new TaggedProfileNoticeStream($this->profile, $this->tag, $p); + } + + $this->notice = $stream->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); + + return true; + } + function isReadOnly($args) { return true; @@ -224,13 +243,9 @@ class ShowstreamAction extends ProfileAction function showNotices() { - $notice = empty($this->tag) - ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) - : $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null); - $pnl = null; - if (Event::handle('ShowStreamNoticeList', array($notice, $this, &$pnl))) { - $pnl = new ProfileNoticeList($notice, $this); + if (Event::handle('ShowStreamNoticeList', array($this->notice, $this, &$pnl))) { + $pnl = new ProfileNoticeList($this->notice, $this); } $cnt = $pnl->show(); if (0 == $cnt) { diff --git a/lib/taggedprofilenoticestream.php b/lib/taggedprofilenoticestream.php index 9998b7d769..eec20cd8c6 100644 --- a/lib/taggedprofilenoticestream.php +++ b/lib/taggedprofilenoticestream.php @@ -47,7 +47,7 @@ if (!defined('STATUSNET')) { class TaggedProfileNoticeStream extends ScopingNoticeStream { - function __construct($profile, $tag, $userProfile) + function __construct($profile, $tag, $userProfile=-1) { if (is_int($userProfile) && $userProfile == -1) { $userProfile = Profile::current();