ConversationAction extends from ManagedAction

Also added some of the nifty autoconfiguration, such as $this->scoped,
to ConversationAction for increased code consistency.
This commit is contained in:
Mikael Nordfeldth 2014-05-11 21:11:09 +02:00
parent aa0fbf89c2
commit f9481467f8

View File

@ -45,12 +45,11 @@ require_once INSTALLDIR.'/lib/noticelist.php';
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/ * @link http://status.net/
*/ */
class ConversationAction extends Action class ConversationAction extends ManagedAction
{ {
var $id = null; var $id = null;
var $page = null; var $page = null;
var $notices = null; var $notices = null;
var $userProfile = null;
const MAX_NOTICES = 500; const MAX_NOTICES = 500;
@ -61,7 +60,7 @@ class ConversationAction extends Action
* *
* @return boolean false if id not passed in * @return boolean false if id not passed in
*/ */
function prepare($args) protected function prepare(array $args=array())
{ {
parent::prepare($args); parent::prepare($args);
$this->id = $this->trimmed('id'); $this->id = $this->trimmed('id');
@ -74,34 +73,13 @@ class ConversationAction extends Action
$this->page = 1; $this->page = 1;
} }
$cur = common_current_user(); $stream = new ConversationNoticeStream($this->id, $this->scoped);
if (empty($cur)) {
$this->userProfile = null;
} else {
$this->userProfile = $cur->getProfile();
}
$stream = new ConversationNoticeStream($this->id, $this->userProfile);
$this->notices = $stream->getNotices(0, self::MAX_NOTICES); $this->notices = $stream->getNotices(0, self::MAX_NOTICES);
return true; return true;
} }
/**
* Handle the action
*
* @param array $args Web and URL arguments
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$this->showPage();
}
/** /**
* Returns the page title * Returns the page title
* *
@ -128,7 +106,7 @@ class ConversationAction extends Action
if (!empty($user) && $user->conversationTree()) { if (!empty($user) && $user->conversationTree()) {
$nl = new ConversationTree($this->notices, $this); $nl = new ConversationTree($this->notices, $this);
} else { } else {
$nl = new FullThreadedNoticeList($this->notices, $this, $this->userProfile); $nl = new FullThreadedNoticeList($this->notices, $this, $this->scoped);
} }
$cnt = $nl->show(); $cnt = $nl->show();