Files
phabricator/src/applications/conpherence/controller/ConpherenceListController.php
Bob Trahan 18c76b8a46 Conpherence - make conpherence load the bare minimum of data
Summary: also re-enables the updating of the widgets and "cleans up" the javascript a tad. Ref T2867

Test Plan: all sorts of conpherence fun like adding people to threads, adding files, pontificating, etc

Reviewers: epriestley, chad

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2867

Differential Revision: https://secure.phabricator.com/D5595
2013-04-08 11:13:35 -07:00

79 lines
1.9 KiB
PHP

<?php
/**
* @group conpherence
*/
final class ConpherenceListController
extends ConpherenceController {
private $conpherenceID;
public function setConpherenceID($conpherence_id) {
$this->conpherenceID = $conpherence_id;
return $this;
}
public function getConpherenceID() {
return $this->conpherenceID;
}
public function willProcessRequest(array $data) {
$this->setConpherenceID(idx($data, 'id'));
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$title = pht('Conpherence');
$conpherence_id = $this->getConpherenceID();
$current_selection_epoch = null;
$conpherence = null;
if ($conpherence_id) {
$conpherence = id(new ConpherenceThreadQuery())
->setViewer($user)
->withIDs(array($conpherence_id))
->executeOne();
if (!$conpherence) {
return new Aphront404Response();
}
if ($conpherence->getTitle()) {
$title = $conpherence->getTitle();
}
$participant = $conpherence->getParticipant($user->getPHID());
$current_selection_epoch = $participant->getDateTouched();
}
list($unread, $read) = $this->loadStartingConpherences(
$current_selection_epoch);
$thread_view = id(new ConpherenceThreadListView())
->setUser($user)
->setBaseURI($this->getApplicationURI())
->setUnreadThreads($unread)
->setReadThreads($read);
if ($request->isAjax()) {
return id(new AphrontAjaxResponse())->setContent($thread_view);
}
$layout = id(new ConpherenceLayoutView())
->setBaseURI($this->getApplicationURI())
->setThreadView($thread_view)
->setRole('list');
if ($conpherence) {
$layout->setThread($conpherence);
}
return $this->buildApplicationPage(
$layout,
array(
'title' => $title,
'device' => true,
));
}
}