mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
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
This commit is contained in:
parent
1fd063277b
commit
787cc1dd82
4 changed files with 26 additions and 23 deletions
|
@ -198,7 +198,6 @@ abstract class ConpherenceController extends PhabricatorController {
|
|||
->setMetadata(
|
||||
array(
|
||||
'id' => $conpherence->getID(),
|
||||
'phid' => $conpherence->getPHID(),
|
||||
));
|
||||
|
||||
return $item;
|
||||
|
|
|
@ -27,7 +27,7 @@ final class ConpherenceListController extends
|
|||
|
||||
$conpherence_id = $this->getConpherenceID();
|
||||
$current_selection_epoch = null;
|
||||
$selected_phid = null;
|
||||
$conpherence = null;
|
||||
if ($conpherence_id) {
|
||||
$conpherence = id(new ConpherenceThreadQuery())
|
||||
->setViewer($user)
|
||||
|
@ -40,7 +40,6 @@ final class ConpherenceListController extends
|
|||
if ($conpherence->getTitle()) {
|
||||
$title = $conpherence->getTitle();
|
||||
}
|
||||
$selected_phid = $conpherence->getPHID();
|
||||
|
||||
$participant = $conpherence->getParticipant($user->getPHID());
|
||||
$current_selection_epoch = $participant->getDateTouched();
|
||||
|
@ -50,8 +49,11 @@ final class ConpherenceListController extends
|
|||
$nav = $this->buildSideNavView();
|
||||
|
||||
$main_pane = id(new ConpherenceLayoutView())
|
||||
->setBaseURI($this->getApplicationURI())
|
||||
->setSelectedConpherencePHID($selected_phid);
|
||||
->setBaseURI($this->getApplicationURI());
|
||||
|
||||
if ($conpherence) {
|
||||
$main_pane->setThread($conpherence);
|
||||
}
|
||||
|
||||
$nav->appendChild(
|
||||
array(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
final class ConpherenceLayoutView extends AphrontView {
|
||||
|
||||
private $selectedConpherencePHID;
|
||||
private $thread;
|
||||
private $baseURI;
|
||||
|
||||
public function setBaseURI($base_uri) {
|
||||
|
@ -10,8 +10,8 @@ final class ConpherenceLayoutView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setSelectedConpherencePHID($selected_conpherence_phid) {
|
||||
$this->selectedConpherencePHID = $selected_conpherence_phid;
|
||||
public function setThread(ConpherenceThread $thread) {
|
||||
$this->thread = $thread;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ final class ConpherenceLayoutView extends AphrontView {
|
|||
'widgets_pane' => 'conpherence-widget-pane',
|
||||
'form_pane' => 'conpherence-form',
|
||||
'menu_pane' => 'conpherence-menu',
|
||||
'selected_conpherence_id' => $this->selectedConpherencePHID,
|
||||
'fancy_ajax' => (bool)$this->selectedConpherencePHID,
|
||||
'selectedID' => ($this->thread ? $this->thread->getID() : null),
|
||||
));
|
||||
|
||||
Javelin::initBehavior('conpherence-drag-and-drop-photo',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
<</**
|
||||
* @provides javelin-behavior-conpherence-menu
|
||||
* @requires javelin-behavior
|
||||
* javelin-dom
|
||||
|
@ -16,6 +16,17 @@ JX.behavior('conpherence-menu', function(config) {
|
|||
visible: null
|
||||
};
|
||||
|
||||
function selectthreadid(id) {
|
||||
var threads = JX.DOM.scry(document.body, 'a', 'conpherence-menu-click');
|
||||
for (var ii = 0; ii < threads.length; ii++) {
|
||||
var data = JX.Stratcom.getData(threads[ii]);
|
||||
if (data.id == id) {
|
||||
selectthread(threads[ii]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function selectthread(node) {
|
||||
if (node === thread.node) {
|
||||
return;
|
||||
|
@ -32,10 +43,9 @@ JX.behavior('conpherence-menu', function(config) {
|
|||
thread.node = node;
|
||||
|
||||
var data = JX.Stratcom.getData(node);
|
||||
thread.selected = data.phid;
|
||||
thread.selected = data.id;
|
||||
|
||||
// TODO: These URIs don't work yet, so don't push them until they do.
|
||||
// JX.History.push(config.base_uri + 'view/' + data.id + '/');
|
||||
JX.History.replace(config.base_uri + data.id + '/');
|
||||
|
||||
redrawthread();
|
||||
}
|
||||
|
@ -155,15 +165,8 @@ JX.behavior('conpherence-menu', function(config) {
|
|||
|
||||
|
||||
// If there's a currently visible thread, select it.
|
||||
if (config.selected_conpherence_id) {
|
||||
var threads = JX.DOM.scry(document.body, 'a', 'conpherence-menu-click');
|
||||
for (var ii = 0; ii < threads.length; ii++) {
|
||||
var data = JX.Stratcom.getData(threads[ii]);
|
||||
if (data.phid == config.selected_conpherence_id) {
|
||||
selectthread(threads[ii]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (config.selectedID) {
|
||||
selectthreadid(config.selectedID);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue