mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-14 16:51:08 +01:00
Transactions - kill the old "show all" code pathways
Summary: we still need to be pager-sensitive, but otherwise this "show all" stuff is dead, dead dead...! Ref T4712. I think we can close the book on T4712 with one more diff to clean up the array_reverse / reverse paging stuff? That diff is probably a bit tricky as it involes auditing every TransactionQuery callsite... Test Plan: viewed a task with a lot of transactions. clicked "show older" and it worked! Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T4712 Differential Revision: https://secure.phabricator.com/D10926
This commit is contained in:
parent
6ab3f06b6e
commit
2856c60932
4 changed files with 17 additions and 138 deletions
|
@ -8,7 +8,7 @@
|
|||
return array(
|
||||
'names' => array(
|
||||
'core.pkg.css' => 'b5618e4c',
|
||||
'core.pkg.js' => 'e64447dc',
|
||||
'core.pkg.js' => 'ef8f73ee',
|
||||
'darkconsole.pkg.js' => 'df001cab',
|
||||
'differential.pkg.css' => '8af45893',
|
||||
'differential.pkg.js' => '42c10e78',
|
||||
|
@ -371,7 +371,6 @@ return array(
|
|||
'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '00861799',
|
||||
'rsrc/js/application/differential/behavior-keyboard-nav.js' => '2c426492',
|
||||
'rsrc/js/application/differential/behavior-populate.js' => 'bdb3e4d0',
|
||||
'rsrc/js/application/differential/behavior-show-all-comments.js' => '7c273581',
|
||||
'rsrc/js/application/differential/behavior-show-field-details.js' => 'bba9eedf',
|
||||
'rsrc/js/application/differential/behavior-show-more.js' => 'dd7e8ef5',
|
||||
'rsrc/js/application/differential/behavior-toggle-files.js' => 'ca3f91eb',
|
||||
|
@ -624,7 +623,6 @@ return array(
|
|||
'javelin-behavior-phabricator-remarkup-assist' => 'e32d14ab',
|
||||
'javelin-behavior-phabricator-reveal-content' => '60821bc7',
|
||||
'javelin-behavior-phabricator-search-typeahead' => '724b1247',
|
||||
'javelin-behavior-phabricator-show-all-transactions' => '7c273581',
|
||||
'javelin-behavior-phabricator-show-older-transactions' => '83458cbb',
|
||||
'javelin-behavior-phabricator-tooltips' => '3ee3408b',
|
||||
'javelin-behavior-phabricator-transaction-comment-form' => '9f7309fb',
|
||||
|
@ -1333,11 +1331,6 @@ return array(
|
|||
'javelin-stratcom',
|
||||
'javelin-util',
|
||||
),
|
||||
'7c273581' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
'javelin-dom',
|
||||
),
|
||||
'7cbe244b' => array(
|
||||
'javelin-install',
|
||||
'javelin-util',
|
||||
|
@ -2095,7 +2088,7 @@ return array(
|
|||
'javelin-fx',
|
||||
'phabricator-draggable-list',
|
||||
'javelin-behavior-phabricator-transaction-list',
|
||||
'javelin-behavior-phabricator-show-all-transactions',
|
||||
'javelin-behavior-phabricator-show-older-transactions',
|
||||
'javelin-behavior-phui-timeline-dropdown-menu',
|
||||
'javelin-behavior-doorkeeper-tag',
|
||||
),
|
||||
|
|
|
@ -66,7 +66,7 @@ return array(
|
|||
'javelin-fx',
|
||||
'phabricator-draggable-list',
|
||||
'javelin-behavior-phabricator-transaction-list',
|
||||
'javelin-behavior-phabricator-show-all-transactions',
|
||||
'javelin-behavior-phabricator-show-older-transactions',
|
||||
'javelin-behavior-phui-timeline-dropdown-menu',
|
||||
'javelin-behavior-doorkeeper-tag',
|
||||
),
|
||||
|
|
|
@ -83,73 +83,25 @@ final class PHUITimelineView extends AphrontView {
|
|||
}
|
||||
|
||||
$events = array();
|
||||
if ($hide) {
|
||||
if ($this->getPager()) {
|
||||
|
||||
$events[] = javelin_tag(
|
||||
'div',
|
||||
array(
|
||||
'sigil' => 'show-older-block',
|
||||
'class' => 'phui-timeline-older-transactions-are-hidden',
|
||||
),
|
||||
array(
|
||||
pht('Older changes are hidden. '),
|
||||
' ',
|
||||
javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
if ($hide && $this->getPager()) {
|
||||
$events[] = javelin_tag(
|
||||
'div',
|
||||
array(
|
||||
'sigil' => 'show-older-block',
|
||||
'class' => 'phui-timeline-older-transactions-are-hidden',
|
||||
),
|
||||
array(
|
||||
pht('Older changes are hidden. '),
|
||||
' ',
|
||||
javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => (string) $this->getPager()->getNextPageURI(),
|
||||
'mustcapture' => true,
|
||||
'sigil' => 'show-older-link',
|
||||
),
|
||||
pht('Show older changes.')),
|
||||
));
|
||||
|
||||
} else {
|
||||
|
||||
$hidden = phutil_implode_html($spacer, $hide);
|
||||
$count = count($hide);
|
||||
|
||||
$show_id = celerity_generate_unique_node_id();
|
||||
$hide_id = celerity_generate_unique_node_id();
|
||||
$link_id = celerity_generate_unique_node_id();
|
||||
|
||||
Javelin::initBehavior(
|
||||
'phabricator-show-all-transactions',
|
||||
array(
|
||||
'anchors' => array_filter(mpull($hide, 'getAnchor')),
|
||||
'linkID' => $link_id,
|
||||
'hideID' => $hide_id,
|
||||
'showID' => $show_id,
|
||||
));
|
||||
|
||||
$events[] = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'id' => $hide_id,
|
||||
'class' => 'phui-timeline-older-transactions-are-hidden',
|
||||
),
|
||||
array(
|
||||
pht('%s older changes(s) are hidden.', new PhutilNumber($count)),
|
||||
' ',
|
||||
javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#',
|
||||
'mustcapture' => true,
|
||||
'id' => $link_id,
|
||||
),
|
||||
pht('Show all changes.')),
|
||||
));
|
||||
|
||||
$events[] = phutil_tag(
|
||||
'div',
|
||||
array(
|
||||
'id' => $show_id,
|
||||
'style' => 'display: none',
|
||||
),
|
||||
$hidden);
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
if ($hide && $show) {
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
/**
|
||||
* @provides javelin-behavior-phabricator-show-all-transactions
|
||||
* @requires javelin-behavior
|
||||
* javelin-stratcom
|
||||
* javelin-dom
|
||||
*/
|
||||
|
||||
/**
|
||||
* Automatically show older transactions if the user follows an anchor to a
|
||||
* transaction which is hidden by the "N older changes are hidden." shield.
|
||||
*/
|
||||
JX.behavior('phabricator-show-all-transactions', function(config) {
|
||||
|
||||
var revealed = false;
|
||||
|
||||
function get_hash() {
|
||||
return window.location.hash.replace(/^#/, '');
|
||||
}
|
||||
|
||||
function hash_is_hidden() {
|
||||
var hash = get_hash();
|
||||
for (var ii = 0; ii < config.anchors.length; ii++) {
|
||||
if (config.anchors[ii] == hash) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function reveal() {
|
||||
if (revealed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JX.DOM.hide(JX.$(config.hideID));
|
||||
JX.DOM.show(JX.$(config.showID));
|
||||
revealed = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function check_hash() {
|
||||
if (hash_is_hidden()) {
|
||||
if (reveal()) {
|
||||
try {
|
||||
var target = JX.$(get_hash());
|
||||
JX.DOM.scrollTo(target);
|
||||
} catch (ignored) {
|
||||
// We did our best.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JX.DOM.listen(
|
||||
JX.$(config.linkID),
|
||||
'click',
|
||||
null,
|
||||
function (e) {
|
||||
e.kill();
|
||||
reveal();
|
||||
});
|
||||
|
||||
JX.Stratcom.listen('hashchange', null, check_hash);
|
||||
check_hash();
|
||||
});
|
Loading…
Reference in a new issue