Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14093791
D17861.id43049.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
27 KB
Referenced Files
None
Subscribers
None
D17861.id43049.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -12,8 +12,8 @@
'core.pkg.css' => 'd1bf3405',
'core.pkg.js' => '2ff7879f',
'darkconsole.pkg.js' => '1f9a31bc',
- 'differential.pkg.css' => '90b30783',
- 'differential.pkg.js' => '2de0157a',
+ 'differential.pkg.css' => '58712637',
+ 'differential.pkg.js' => '70685319',
'diffusion.pkg.css' => 'b93d9b8c',
'diffusion.pkg.js' => '84c8f8fd',
'favicon.ico' => '30672e08',
@@ -66,7 +66,7 @@
'rsrc/css/application/differential/add-comment.css' => 'c47f8c40',
'rsrc/css/application/differential/changeset-view.css' => '41af6d25',
'rsrc/css/application/differential/core.css' => '5b7b8ff4',
- 'rsrc/css/application/differential/phui-inline-comment.css' => 'be663c95',
+ 'rsrc/css/application/differential/phui-inline-comment.css' => '3fd8ca64',
'rsrc/css/application/differential/revision-comment.css' => '14b8565a',
'rsrc/css/application/differential/revision-history.css' => '0e8eb855',
'rsrc/css/application/differential/revision-list.css' => 'f3c47d33',
@@ -390,16 +390,17 @@
'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/DiffChangeset.js' => '2cbf5575',
- 'rsrc/js/application/diff/DiffChangesetList.js' => '16c14b02',
+ 'rsrc/js/application/diff/DiffChangeset.js' => '80ac3298',
+ 'rsrc/js/application/diff/DiffChangesetList.js' => 'a34b9821',
+ 'rsrc/js/application/diff/DiffInline.js' => 'f9e76f2d',
'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832',
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => '2e3f9738',
'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d',
'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76',
'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1',
- 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => 'c0f1c3b5',
+ 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => 'e7e9551e',
'rsrc/js/application/differential/behavior-keyboard-nav.js' => '92904457',
- 'rsrc/js/application/differential/behavior-populate.js' => '8991de30',
+ 'rsrc/js/application/differential/behavior-populate.js' => '5e41c819',
'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',
@@ -623,10 +624,10 @@
'javelin-behavior-diff-preview-link' => '051c7832',
'javelin-behavior-differential-comment-jump' => '4fdb476d',
'javelin-behavior-differential-diff-radios' => 'e1ff79b1',
- 'javelin-behavior-differential-edit-inline-comments' => 'c0f1c3b5',
+ 'javelin-behavior-differential-edit-inline-comments' => 'e7e9551e',
'javelin-behavior-differential-feedback-preview' => 'b064af76',
'javelin-behavior-differential-keyboard-navigation' => '92904457',
- 'javelin-behavior-differential-populate' => '8991de30',
+ 'javelin-behavior-differential-populate' => '5e41c819',
'javelin-behavior-differential-toggle-files' => 'ca3f91eb',
'javelin-behavior-differential-user-select' => 'a8d8459d',
'javelin-behavior-diffusion-browse-file' => '054a0f0b',
@@ -784,8 +785,9 @@
'phabricator-darklog' => 'c8e1ffe3',
'phabricator-darkmessage' => 'c48cccdd',
'phabricator-dashboard-css' => 'fe5b1869',
- 'phabricator-diff-changeset' => '2cbf5575',
- 'phabricator-diff-changeset-list' => '16c14b02',
+ 'phabricator-diff-changeset' => '80ac3298',
+ 'phabricator-diff-changeset-list' => 'a34b9821',
+ 'phabricator-diff-inline' => 'f9e76f2d',
'phabricator-drag-and-drop-file-upload' => '58dea2fa',
'phabricator-draggable-list' => 'bea6e7f4',
'phabricator-fatal-config-template-css' => '8f18fa41',
@@ -868,7 +870,7 @@
'phui-image-mask-css' => 'a8498f9c',
'phui-info-panel-css' => '27ea50a1',
'phui-info-view-css' => '6e217679',
- 'phui-inline-comment-view-css' => 'be663c95',
+ 'phui-inline-comment-view-css' => '3fd8ca64',
'phui-invisible-character-view-css' => '6993d9f0',
'phui-lightbox-css' => '0a035e40',
'phui-list-view-css' => '12eb8ce6',
@@ -1004,9 +1006,6 @@
'javelin-dom',
'javelin-history',
),
- '16c14b02' => array(
- 'javelin-install',
- ),
'17bb8539' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1116,16 +1115,6 @@
'javelin-install',
'javelin-event',
),
- '2cbf5575' => array(
- 'javelin-dom',
- 'javelin-util',
- 'javelin-stratcom',
- 'javelin-install',
- 'javelin-workflow',
- 'javelin-router',
- 'javelin-behavior-device',
- 'javelin-vector',
- ),
'2e3f9738' => array(
'javelin-dom',
'javelin-util',
@@ -1388,6 +1377,14 @@
'phabricator-phtize',
'javelin-dom',
),
+ '5e41c819' => array(
+ 'javelin-behavior',
+ 'javelin-dom',
+ 'javelin-stratcom',
+ 'phabricator-tooltip',
+ 'phabricator-diff-changeset-list',
+ 'phabricator-diff-changeset',
+ ),
'5e9f347c' => array(
'javelin-behavior',
'multirow-row-manager',
@@ -1538,6 +1535,17 @@
'javelin-vector',
'javelin-stratcom',
),
+ '80ac3298' => array(
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-stratcom',
+ 'javelin-install',
+ 'javelin-workflow',
+ 'javelin-router',
+ 'javelin-behavior-device',
+ 'javelin-vector',
+ 'phabricator-diff-inline',
+ ),
'834a1173' => array(
'javelin-behavior',
'javelin-scrollbar',
@@ -1590,14 +1598,6 @@
'phabricator-draggable-list',
'javelin-workboard-column',
),
- '8991de30' => array(
- 'javelin-behavior',
- 'javelin-dom',
- 'javelin-stratcom',
- 'phabricator-tooltip',
- 'phabricator-diff-changeset-list',
- 'phabricator-diff-changeset',
- ),
'8a41885b' => array(
'javelin-install',
'javelin-dom',
@@ -1719,6 +1719,9 @@
'javelin-dom',
'javelin-reactor-dom',
),
+ 'a34b9821' => array(
+ 'javelin-install',
+ ),
'a3a63478' => array(
'phui-workcard-view-css',
),
@@ -1932,14 +1935,6 @@
'javelin-install',
'javelin-dom',
),
- 'c0f1c3b5' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-util',
- 'javelin-vector',
- 'differential-inline-comment-editor',
- ),
'c420b0b9' => array(
'javelin-behavior',
'javelin-behavior-device',
@@ -2161,6 +2156,14 @@
'javelin-workflow',
'javelin-magical-init',
),
+ 'e7e9551e' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-vector',
+ 'differential-inline-comment-editor',
+ ),
'e9581f08' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -2225,6 +2228,9 @@
'javelin-install',
'javelin-dom',
),
+ 'f9e76f2d' => array(
+ 'javelin-dom',
+ ),
'fbe497e7' => array(
'javelin-behavior',
'javelin-util',
diff --git a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php
--- a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php
+++ b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php
@@ -41,8 +41,6 @@
$column_width = 4;
- $hidden = new PHUIDiffRevealIconView();
-
$out = array();
foreach ($primitives as $k => $p) {
$type = $p['type'];
@@ -53,27 +51,6 @@
case 'new-file':
$is_old = ($type == 'old' || $type == 'old-file');
- $o_hidden = array();
- $n_hidden = array();
-
- for ($look = $k + 1; isset($primitives[$look]); $look++) {
- $next = $primitives[$look];
- switch ($next['type']) {
- case 'inline':
- $comment = $next['comment'];
- if ($comment->isHidden()) {
- if ($next['right']) {
- $n_hidden[] = $comment;
- } else {
- $o_hidden[] = $comment;
- }
- }
- break;
- default:
- break 2;
- }
- }
-
$cells = array();
if ($is_old) {
if ($p['htype']) {
@@ -93,9 +70,6 @@
}
$line = $p['line'];
- if ($o_hidden) {
- $line = array($hidden, $line);
- }
$cells[] = phutil_tag(
'th',
@@ -122,9 +96,6 @@
}
$oline = $p['oline'];
- if ($o_hidden) {
- $oline = array($hidden, $oline);
- }
$cells[] = phutil_tag('th', array('id' => $left_id), $oline);
}
@@ -140,9 +111,6 @@
}
$line = $p['line'];
- if ($n_hidden) {
- $line = array($hidden, $line);
- }
$cells[] = phutil_tag(
'th',
diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
--- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
+++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
@@ -69,8 +69,6 @@
$depths = $this->getDepths();
$mask = $this->getMask();
- $hidden = new PHUIDiffRevealIconView();
-
for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) {
if (empty($mask[$ii])) {
// If we aren't going to show this line, we've just entered a gap.
@@ -241,9 +239,6 @@
$new_comments = $this->getNewComments();
$scaffolds = array();
- $o_hidden = array();
- $n_hidden = array();
-
if ($o_num && isset($old_comments[$o_num])) {
foreach ($old_comments[$o_num] as $comment) {
$inline = $this->buildInlineComment(
@@ -251,10 +246,6 @@
$on_right = false);
$scaffold = $this->getRowScaffoldForInline($inline);
- if ($comment->isHidden()) {
- $o_hidden[] = $comment;
- }
-
if ($n_num && isset($new_comments[$n_num])) {
foreach ($new_comments[$n_num] as $key => $new_comment) {
if ($comment->isCompatible($new_comment)) {
@@ -262,10 +253,6 @@
$new_comment,
$on_right = true);
- if ($new_comment->isHidden()) {
- $n_hidden = $new_comment;
- }
-
$scaffold->addInlineView($companion);
unset($new_comments[$n_num][$key]);
break;
@@ -284,22 +271,10 @@
$comment,
$on_right = true);
- if ($comment->isHidden()) {
- $n_hidden[] = $comment;
- }
-
$scaffolds[] = $this->getRowScaffoldForInline($inline);
}
}
- if ($o_hidden) {
- $o_num = array($hidden, $o_num);
- }
-
- if ($n_hidden) {
- $n_num = array($hidden, $n_num);
- }
-
// NOTE: This is a unicode zero-width space, which we use as a hint when
// intercepting 'copy' events to make sure sensible text ends up on the
// clipboard. See the 'phabricator-oncopy' behavior.
diff --git a/src/applications/differential/view/DifferentialChangesetDetailView.php b/src/applications/differential/view/DifferentialChangesetDetailView.php
--- a/src/applications/differential/view/DifferentialChangesetDetailView.php
+++ b/src/applications/differential/view/DifferentialChangesetDetailView.php
@@ -166,7 +166,7 @@
'ref' => $this->getRenderingRef(),
'autoload' => $this->getAutoload(),
'loaded' => $this->getLoaded(),
- 'undoTemplates' => $renderer->renderUndoTemplates(),
+ 'undoTemplates' => hsprintf('%s', $renderer->renderUndoTemplates()),
),
'class' => $class,
'id' => $id,
diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php
--- a/src/applications/differential/view/DifferentialChangesetListView.php
+++ b/src/applications/differential/view/DifferentialChangesetListView.php
@@ -146,11 +146,6 @@
foreach ($changesets as $key => $changeset) {
$file = $changeset->getFilename();
- $class = 'differential-changeset';
- if (!$this->inlineURI) {
- $class .= ' differential-changeset-noneditable';
- }
-
$ref = $this->references[$key];
$detail = id(new DifferentialChangesetDetailView())
@@ -219,6 +214,7 @@
'differential-populate',
array(
'changesetViewIDs' => $ids,
+ 'inlineURI' => $this->inlineURI,
'pht' => array(
'Open in Editor' => pht('Open in Editor'),
'Show All Context' => pht('Show All Context'),
@@ -247,7 +243,6 @@
Javelin::initBehavior('differential-edit-inline-comments', array(
'uri' => $this->inlineURI,
'stage' => 'differential-review-stage',
- 'revealIcon' => hsprintf('%s', new PHUIDiffRevealIconView()),
));
}
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
@@ -450,7 +450,20 @@
phutil_tag_div('phabricator-remarkup', $content)),
));
- return $markup;
+ $summary = phutil_tag(
+ 'div',
+ array(
+ 'class' => 'differential-inline-summary',
+ ),
+
+ // TODO: Render something a little more useful here as a hint about the
+ // inline content, like "alincoln: first line of text...".
+ pht('...'));
+
+ return array(
+ $markup,
+ $summary,
+ );
}
private function canHide() {
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php
@@ -21,21 +21,28 @@
}
protected function getRowAttributes() {
- // TODO: This is semantic information used by the JS when placing comments
- // and using keyboard navigation; we should move it out of class names.
-
- $style = null;
+ $is_hidden = false;
foreach ($this->getInlineViews() as $view) {
if ($view->isHidden()) {
- $style = 'display: none';
+ $is_hidden = true;
}
}
- return array(
- 'class' => 'inline',
+ $classes = array();
+ $classes[] = 'inline';
+ if ($is_hidden) {
+ $classes[] = 'inline-hidden';
+ }
+
+ $result = array(
+ 'class' => implode(' ', $classes),
'sigil' => 'inline-row',
- 'style' => $style,
+ 'meta' => array(
+ 'hidden' => $is_hidden,
+ ),
);
+
+ return $result;
}
}
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php
@@ -9,6 +9,10 @@
final class PHUIDiffInlineCommentUndoView
extends PHUIDiffInlineCommentView {
+ public function isHideable() {
+ return false;
+ }
+
public function render() {
$link = javelin_tag(
'a',
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php
@@ -21,4 +21,16 @@
return false;
}
+ public function isHideable() {
+ return true;
+ }
+
+ public function newHiddenIcon() {
+ if ($this->isHideable()) {
+ return new PHUIDiffRevealIconView();
+ } else {
+ return null;
+ }
+ }
+
}
diff --git a/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php
--- a/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php
+++ b/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php
@@ -22,9 +22,17 @@
'id' => $inline->getScaffoldCellID(),
);
+ if ($inline->getIsOnRight()) {
+ $left_hidden = null;
+ $right_hidden = $inline->newHiddenIcon();
+ } else {
+ $left_hidden = $inline->newHiddenIcon();
+ $right_hidden = null;
+ }
+
$cells = array(
- phutil_tag('th', array()),
- phutil_tag('th', array()),
+ phutil_tag('th', array(), $left_hidden),
+ phutil_tag('th', array(), $right_hidden),
phutil_tag('td', $attrs, $inline),
);
diff --git a/src/infrastructure/diff/view/PHUIDiffRevealIconView.php b/src/infrastructure/diff/view/PHUIDiffRevealIconView.php
--- a/src/infrastructure/diff/view/PHUIDiffRevealIconView.php
+++ b/src/infrastructure/diff/view/PHUIDiffRevealIconView.php
@@ -8,7 +8,7 @@
->addSigil('has-tooltip')
->setMetadata(
array(
- 'tip' => pht('Show Hidden Comments'),
+ 'tip' => pht('Show Hidden Comment'),
'align' => 'E',
'size' => 275,
));
@@ -17,8 +17,8 @@
'a',
array(
'href' => '#',
- 'class' => 'reveal-inlines',
- 'sigil' => 'reveal-inlines',
+ 'class' => 'reveal-inline',
+ 'sigil' => 'reveal-inline',
'mustcapture' => true,
),
$icon);
diff --git a/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php
--- a/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php
+++ b/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php
@@ -27,9 +27,15 @@
if ($inline->getIsOnRight()) {
$left_side = null;
$right_side = $inline;
+
+ $left_hidden = null;
+ $right_hidden = $inline->newHiddenIcon();
} else {
$left_side = $inline;
$right_side = null;
+
+ $left_hidden = $inline->newHiddenIcon();
+ $right_hidden = null;
}
} else {
list($u, $v) = $inlines;
@@ -48,6 +54,9 @@
$left_side = $v;
$right_side = $u;
}
+
+ $left_hidden = null;
+ $right_hidden = null;
}
$left_attrs = array(
@@ -62,9 +71,9 @@
);
$cells = array(
- phutil_tag('th', array()),
+ phutil_tag('th', array(), $left_hidden),
phutil_tag('td', $left_attrs, $left_side),
- phutil_tag('th', array()),
+ phutil_tag('th', array(), $right_hidden),
phutil_tag('td', $right_attrs, $right_side),
);
diff --git a/webroot/rsrc/css/application/differential/phui-inline-comment.css b/webroot/rsrc/css/application/differential/phui-inline-comment.css
--- a/webroot/rsrc/css/application/differential/phui-inline-comment.css
+++ b/webroot/rsrc/css/application/differential/phui-inline-comment.css
@@ -374,17 +374,36 @@
/* - Hiding Inlines ------------------------------------------------------------
*/
-.reveal-inlines {
- float: left;
- margin-left: 4px;
+.reveal-inline {
color: {$lightbluetext};
+ margin: 4px 0;
+ display: none;
+}
+
+.inline-hidden .reveal-inline {
+ display: block;
+}
+
+.inline-hidden .differential-inline-comment {
+ display: none;
+}
+
+.differential-inline-summary {
+ background: {$greybackground};
+ padding: 0 4px;
+ color: {$greytext};
+ display: none;
+}
+
+.inline-hidden .differential-inline-summary {
+ display: block;
}
-.reveal-inlines span.phui-icon-view {
+.reveal-inline span.phui-icon-view {
color: {$lightbluetext};
}
-.reveal-inlines:hover span.phui-icon-view {
+.reveal-inline:hover span.phui-icon-view {
color: {$darkbluetext};
}
diff --git a/webroot/rsrc/js/application/diff/DiffChangeset.js b/webroot/rsrc/js/application/diff/DiffChangeset.js
--- a/webroot/rsrc/js/application/diff/DiffChangeset.js
+++ b/webroot/rsrc/js/application/diff/DiffChangeset.js
@@ -8,6 +8,8 @@
* javelin-router
* javelin-behavior-device
* javelin-vector
+ * phabricator-diff-inline
+ * @javelin
*/
@@ -24,6 +26,8 @@
this._highlight = data.highlight;
this._encoding = data.encoding;
this._loaded = data.loaded;
+
+ this._inlines = [];
},
properties: {
@@ -44,6 +48,7 @@
_encoding: null,
_undoTemplates: null,
+ _inlines: null,
/**
* Has the content of this changeset been loaded?
@@ -401,6 +406,20 @@
_getRoutableKey: function() {
return 'changeset-view.' + this._ref + '.' + this._sequence;
+ },
+
+ getInlineForRow: function(node) {
+ var data = JX.Stratcom.getData(node);
+
+ if (!data.inline) {
+ var inline = new JX.DiffInline(node)
+ .setChangeset(this);
+
+ this._inlines.push(inline);
+ data.inline = inline;
+ }
+
+ return data.inline;
}
},
diff --git a/webroot/rsrc/js/application/diff/DiffChangesetList.js b/webroot/rsrc/js/application/diff/DiffChangesetList.js
--- a/webroot/rsrc/js/application/diff/DiffChangesetList.js
+++ b/webroot/rsrc/js/application/diff/DiffChangesetList.js
@@ -17,10 +17,17 @@
var onmenu = JX.bind(this, this._ifawake, this._onmenu);
JX.Stratcom.listen('click', 'differential-view-options', onmenu);
+
+ var onhide = JX.bind(this, this._ifawake, this._onhide);
+ JX.Stratcom.listen('click', 'hide-inline', onhide);
+
+ var onreveal = JX.bind(this, this._ifawake, this._onreveal);
+ JX.Stratcom.listen('click', 'reveal-inline', onreveal);
},
properties: {
- translations: null
+ translations: null,
+ inlineURI: null
},
members: {
@@ -309,9 +316,27 @@
data.menu = menu;
menu.open();
- }
+ },
+
+ _onhide: function(e) {
+ this._onhidereveal(e, true);
+ },
+
+ _onreveal: function(e) {
+ this._onhidereveal(e, false);
+ },
+ _onhidereveal: function(e, is_hide) {
+ e.kill();
+ var node = e.getNode('differential-changeset');
+ var changeset = this.getChangesetForNode(node);
+
+ var inline_node = e.getNode('inline-row');
+ var inline = changeset.getInlineForRow(inline_node);
+
+ inline.setHidden(is_hide);
+ }
}
diff --git a/webroot/rsrc/js/application/diff/DiffInline.js b/webroot/rsrc/js/application/diff/DiffInline.js
new file mode 100644
--- /dev/null
+++ b/webroot/rsrc/js/application/diff/DiffInline.js
@@ -0,0 +1,56 @@
+/**
+ * @provides phabricator-diff-inline
+ * @requires javelin-dom
+ * @javelin
+ */
+
+JX.install('DiffInline', {
+
+ construct : function(row) {
+ this._row = row;
+
+ var data = JX.Stratcom.getData(row);
+ this._hidden = data.hidden || false;
+
+ // TODO: Get smarter about this once we do more editing, this is pretty
+ // hacky.
+ var comment = JX.DOM.find(row, 'div', 'differential-inline-comment');
+ this._id = JX.Stratcom.getData(comment).id;
+ },
+
+ properties: {
+ changeset: null
+ },
+
+ members: {
+ _id: null,
+ _row: null,
+ _hidden: false,
+
+ setHidden: function(hidden) {
+ this._hidden = hidden;
+
+ JX.DOM.alterClass(this._row, 'inline-hidden', this._hidden);
+
+ var op;
+ if (hidden) {
+ op = 'hide';
+ } else {
+ op = 'show';
+ }
+
+ var inline_uri = this._getChangesetList().getInlineURI();
+ var comment_id = this._id;
+
+ new JX.Workflow(inline_uri, {op: op, ids: comment_id})
+ .setHandler(JX.bag)
+ .start();
+ },
+
+ _getChangesetList: function() {
+ var changeset = this.getChangeset();
+ return changeset.getChangesetList();
+ }
+ }
+
+});
diff --git a/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js b/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
--- a/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
+++ b/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
@@ -425,87 +425,4 @@
handle_inline_action(data.node, data.op);
});
- // Respond to the user clicking the "Hide Inline" button on an inline
- // comment.
- JX.Stratcom.listen('click', 'hide-inline', function(e) {
- e.kill();
-
- var row = e.getNode('inline-row');
- JX.DOM.hide(row);
-
- var prev = row.previousSibling;
- while (prev && JX.Stratcom.hasSigil(prev, 'inline-row')) {
- prev = prev.previousSibling;
- }
-
- if (!prev) {
- return;
- }
-
- var comment = e.getNodeData('differential-inline-comment');
-
- var slots = [];
- for (var ii = 0; ii < prev.childNodes.length; ii++) {
- if (JX.DOM.isType(prev.childNodes[ii], 'th')) {
- slots.push(prev.childNodes[ii]);
- }
- }
-
- // Select the right-hand side if the comment is on the right.
- var slot = (comment.on_right && slots[1]) || slots[0];
-
- var reveal = JX.DOM.scry(slot, 'a', 'reveal-inlines')[0];
- if (!reveal) {
- reveal = JX.$N(
- 'a',
- {
- className: 'reveal-inlines',
- sigil: 'reveal-inlines'
- },
- JX.$H(config.revealIcon));
-
- JX.DOM.prependContent(slot, reveal);
- }
-
- new JX.Workflow(config.uri, {op: 'hide', ids: comment.id})
- .setHandler(JX.bag)
- .start();
- });
-
- JX.Stratcom.listen('click', 'reveal-inlines', function(e) {
- e.kill();
-
- var row = e.getNode('tag:tr');
- var next = row.nextSibling;
-
- var ids = [];
- var ii;
-
- // Show any hidden inline comment rows directly below this one.
- while (next && JX.Stratcom.hasSigil(next, 'inline-row')) {
- JX.DOM.show(next);
-
- var comments = JX.DOM.scry(next, 'div', 'differential-inline-comment');
- for (ii = 0; ii < comments.length; ii++) {
- var id = JX.Stratcom.getData(comments[ii]).id;
- if (id) {
- ids.push(id);
- }
- }
-
- next = next.nextSibling;
- }
-
- // Remove any "reveal" icons on the row.
- var reveals = JX.DOM.scry(row, 'a', 'reveal-inlines');
- for (ii = 0; ii < reveals.length; ii++) {
- JX.DOM.remove(reveals[ii]);
- }
-
- new JX.Workflow(config.uri, {op: 'show', ids: ids.join(',')})
- .setHandler(JX.bag)
- .start();
- });
-
-
});
diff --git a/webroot/rsrc/js/application/differential/behavior-populate.js b/webroot/rsrc/js/application/differential/behavior-populate.js
--- a/webroot/rsrc/js/application/differential/behavior-populate.js
+++ b/webroot/rsrc/js/application/differential/behavior-populate.js
@@ -59,7 +59,8 @@
}
var changeset_list = new JX.DiffChangesetList()
- .setTranslations(JX.phtize(config.pht));
+ .setTranslations(JX.phtize(config.pht))
+ .setInlineURI(config.inlineURI);
// Install and activate the current page.
var page_id = JX.Quicksand.getCurrentPageID();
@@ -71,7 +72,6 @@
for (var ii = 0; ii < config.changesetViewIDs.length; ii++) {
var id = config.changesetViewIDs[ii];
var node = JX.$(id);
-
var changeset = changeset_list.newChangesetForNode(node);
if (changeset.shouldAutoload()) {
changeset.setStabilize(true).load();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 26, 12:56 PM (20 h, 30 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6789490
Default Alt Text
D17861.id43049.diff (27 KB)
Attached To
Mode
D17861: Hide inlines one-by-one, instead of in a big group
Attached
Detach File
Event Timeline
Log In to Comment