1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 02:02:41 +01:00
phorge-phorge/src/applications/conpherence/controller/ConpherenceListController.php
epriestley 787cc1dd82 Make id/phid Conpherence stuff more consistent
Summary:
Currently, `selected_conpherence_id` is actually a PHID. Instead, use ids everywhere.

Also, use replaceState instead of pushState. This means "back" takes you out of conpherence (not back to the last thread you looked at) but I think that's more consistent with user expectation.

Test Plan: Loaded thread list, loaded specific thread.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D5503
2013-04-01 12:44:00 -07:00

71 lines
1.6 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();
}
$this->loadStartingConpherences($current_selection_epoch);
$nav = $this->buildSideNavView();
$main_pane = id(new ConpherenceLayoutView())
->setBaseURI($this->getApplicationURI());
if ($conpherence) {
$main_pane->setThread($conpherence);
}
$nav->appendChild(
array(
$main_pane,
));
return $this->buildApplicationPage(
$nav,
array(
'title' => $title,
'device' => true,
));
}
}