mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Gently move some listeners into DiffChangesetList
Summary: Ref T12616. Put these listeners in DiffChangesetList so the wake/sleep properly for Quicksand. Test Plan: - Added some logging. - With quicksand, moved between diffs. - Saw "load" and "show more" fire exactly once on each page, with the correct changeset list listener. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12616 Differential Revision: https://secure.phabricator.com/D17841
This commit is contained in:
parent
404fe482d9
commit
993d942117
3 changed files with 79 additions and 50 deletions
|
@ -13,7 +13,7 @@ return array(
|
|||
'core.pkg.js' => '2ff7879f',
|
||||
'darkconsole.pkg.js' => '1f9a31bc',
|
||||
'differential.pkg.css' => '90b30783',
|
||||
'differential.pkg.js' => '84d27954',
|
||||
'differential.pkg.js' => '8532657e',
|
||||
'diffusion.pkg.css' => 'b93d9b8c',
|
||||
'diffusion.pkg.js' => '84c8f8fd',
|
||||
'favicon.ico' => '30672e08',
|
||||
|
@ -390,7 +390,7 @@ return array(
|
|||
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173',
|
||||
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
|
||||
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
|
||||
'rsrc/js/application/diff/DiffChangesetList.js' => '58c4c0d6',
|
||||
'rsrc/js/application/diff/DiffChangesetList.js' => '9137a890',
|
||||
'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832',
|
||||
'rsrc/js/application/differential/ChangesetViewManager.js' => 'a2828756',
|
||||
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => '2e3f9738',
|
||||
|
@ -400,7 +400,7 @@ return array(
|
|||
'rsrc/js/application/differential/behavior-dropdown-menus.js' => '9a6b9324',
|
||||
'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '4fbbc3e9',
|
||||
'rsrc/js/application/differential/behavior-keyboard-nav.js' => '92904457',
|
||||
'rsrc/js/application/differential/behavior-populate.js' => 'c0c44c3e',
|
||||
'rsrc/js/application/differential/behavior-populate.js' => 'cf707904',
|
||||
'rsrc/js/application/differential/behavior-toggle-files.js' => 'ca3f91eb',
|
||||
'rsrc/js/application/differential/behavior-user-select.js' => 'a8d8459d',
|
||||
'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => 'c93358e3',
|
||||
|
@ -629,7 +629,7 @@ return array(
|
|||
'javelin-behavior-differential-edit-inline-comments' => '4fbbc3e9',
|
||||
'javelin-behavior-differential-feedback-preview' => 'b064af76',
|
||||
'javelin-behavior-differential-keyboard-navigation' => '92904457',
|
||||
'javelin-behavior-differential-populate' => 'c0c44c3e',
|
||||
'javelin-behavior-differential-populate' => 'cf707904',
|
||||
'javelin-behavior-differential-toggle-files' => 'ca3f91eb',
|
||||
'javelin-behavior-differential-user-select' => 'a8d8459d',
|
||||
'javelin-behavior-diffusion-browse-file' => '054a0f0b',
|
||||
|
@ -787,7 +787,7 @@ return array(
|
|||
'phabricator-darklog' => 'c8e1ffe3',
|
||||
'phabricator-darkmessage' => 'c48cccdd',
|
||||
'phabricator-dashboard-css' => 'fe5b1869',
|
||||
'phabricator-diff-changeset-list' => '58c4c0d6',
|
||||
'phabricator-diff-changeset-list' => '9137a890',
|
||||
'phabricator-drag-and-drop-file-upload' => '58dea2fa',
|
||||
'phabricator-draggable-list' => 'bea6e7f4',
|
||||
'phabricator-fatal-config-template-css' => '8f18fa41',
|
||||
|
@ -1355,9 +1355,6 @@ return array(
|
|||
'javelin-vector',
|
||||
'javelin-dom',
|
||||
),
|
||||
'58c4c0d6' => array(
|
||||
'javelin-install',
|
||||
),
|
||||
'58dea2fa' => array(
|
||||
'javelin-install',
|
||||
'javelin-util',
|
||||
|
@ -1621,6 +1618,9 @@ return array(
|
|||
'javelin-dom',
|
||||
'javelin-request',
|
||||
),
|
||||
'9137a890' => array(
|
||||
'javelin-install',
|
||||
),
|
||||
92904457 => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
|
@ -1946,14 +1946,6 @@ return array(
|
|||
'javelin-install',
|
||||
'javelin-dom',
|
||||
),
|
||||
'c0c44c3e' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'phabricator-tooltip',
|
||||
'changeset-view-manager',
|
||||
'phabricator-diff-changeset-list',
|
||||
),
|
||||
'c420b0b9' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-behavior-device',
|
||||
|
@ -2041,6 +2033,14 @@ return array(
|
|||
'cd2b9b77' => array(
|
||||
'phui-oi-list-view-css',
|
||||
),
|
||||
'cf707904' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'phabricator-tooltip',
|
||||
'changeset-view-manager',
|
||||
'phabricator-diff-changeset-list',
|
||||
),
|
||||
'd0c516d5' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-dom',
|
||||
|
|
|
@ -8,16 +8,78 @@ JX.install('DiffChangesetList', {
|
|||
|
||||
construct: function() {
|
||||
|
||||
var onload = JX.bind(this, this._ifawake, this._onload);
|
||||
JX.Stratcom.listen('click', 'differential-load', onload);
|
||||
|
||||
var onmore = JX.bind(this, this._ifawake, this._onmore);
|
||||
JX.Stratcom.listen('click', 'show-more', onmore);
|
||||
},
|
||||
|
||||
members: {
|
||||
_asleep: true,
|
||||
|
||||
sleep: function() {
|
||||
|
||||
this._asleep = true;
|
||||
},
|
||||
|
||||
wake: function() {
|
||||
this._asleep = false;
|
||||
},
|
||||
|
||||
isAsleep: function() {
|
||||
return this._asleep;
|
||||
},
|
||||
|
||||
getChangesetForNode: function(node) {
|
||||
return JX.ChangesetViewManager.getForNode(node);
|
||||
},
|
||||
|
||||
_ifawake: function(f) {
|
||||
// This function takes another function and only calls it if the
|
||||
// changeset list is awake, so we basically just ignore events when we
|
||||
// are asleep. This may move up the stack at some point as we do more
|
||||
// with Quicksand/Sheets.
|
||||
|
||||
if (this.isAsleep()) {
|
||||
return;
|
||||
}
|
||||
|
||||
return f.apply(this, [].slice.call(arguments, 1));
|
||||
},
|
||||
|
||||
_onload: function(e) {
|
||||
var data = e.getNodeData('differential-load');
|
||||
|
||||
// NOTE: We can trigger a load from either an explicit "Load" link on
|
||||
// the changeset, or by clicking a link in the table of contents. If
|
||||
// the event was a table of contents link, we let the anchor behavior
|
||||
// run normally.
|
||||
if (data.kill) {
|
||||
e.kill();
|
||||
}
|
||||
|
||||
var node = JX.$(data.id);
|
||||
var changeset = this.getChangesetForNode(node);
|
||||
|
||||
changeset.load();
|
||||
|
||||
// TODO: Move this into Changeset.
|
||||
var routable = changeset.getRoutable();
|
||||
if (routable) {
|
||||
routable.setPriority(2000);
|
||||
}
|
||||
},
|
||||
|
||||
_onmore: function(e) {
|
||||
e.kill();
|
||||
|
||||
var node = e.getNode('differential-changeset');
|
||||
var changeset = this.getChangesetForNode(node);
|
||||
|
||||
var data = e.getNodeData('show-more');
|
||||
var target = e.getNode('context-target');
|
||||
|
||||
changeset.loadContext(data.range, target);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -75,39 +75,6 @@ JX.behavior('differential-populate', function(config, statics) {
|
|||
}
|
||||
}
|
||||
|
||||
JX.Stratcom.listen(
|
||||
'click',
|
||||
'differential-load',
|
||||
function(e) {
|
||||
var meta = e.getNodeData('differential-load');
|
||||
var changeset = JX.$(meta.id);
|
||||
var view = JX.ChangesetViewManager.getForNode(changeset);
|
||||
|
||||
view.load();
|
||||
var routable = view.getRoutable();
|
||||
if (routable) {
|
||||
routable.setPriority(2000);
|
||||
}
|
||||
|
||||
if (meta.kill) {
|
||||
e.kill();
|
||||
}
|
||||
});
|
||||
|
||||
JX.Stratcom.listen(
|
||||
'click',
|
||||
'show-more',
|
||||
function(e) {
|
||||
e.kill();
|
||||
|
||||
var changeset = e.getNode('differential-changeset');
|
||||
var view = JX.ChangesetViewManager.getForNode(changeset);
|
||||
var data = e.getNodeData('show-more');
|
||||
var target = e.getNode('context-target');
|
||||
|
||||
view.loadContext(data.range, target);
|
||||
});
|
||||
|
||||
var highlighted = null;
|
||||
var highlight_class = null;
|
||||
|
||||
|
|
Loading…
Reference in a new issue