@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

When a directory has a single directory child, collapse them into a single "a/b/" path entry

Summary:
Ref T13516. Instead of rendering trees like this:

- a/
- b/
- c.txt

...render:

- a/b/
- c.txt

Test Plan: {F7374205}

Maniphest Tasks: T13516

Differential Revision: https://secure.phabricator.com/D21155

+137 -20
+12 -12
resources/celerity/map.php
··· 59 59 'rsrc/css/application/countdown/timer.css' => 'bff8012f', 60 60 'rsrc/css/application/daemon/bulk-job.css' => '73af99f5', 61 61 'rsrc/css/application/dashboard/dashboard.css' => '5a205b9d', 62 - 'rsrc/css/application/diff/diff-tree-view.css' => '8f487a99', 62 + 'rsrc/css/application/diff/diff-tree-view.css' => 'bd83417c', 63 63 'rsrc/css/application/diff/inline-comment-summary.css' => '81eb368d', 64 64 'rsrc/css/application/differential/add-comment.css' => '7e5900d9', 65 65 'rsrc/css/application/differential/changeset-view.css' => '489b6995', ··· 381 381 'rsrc/js/application/diff/DiffChangeset.js' => '2a3101b1', 382 382 'rsrc/js/application/diff/DiffChangesetList.js' => '57035863', 383 383 'rsrc/js/application/diff/DiffInline.js' => '16e97ebc', 384 - 'rsrc/js/application/diff/DiffPathView.js' => 'c0ed32ce', 385 - 'rsrc/js/application/diff/DiffTreeView.js' => 'a5823e4d', 384 + 'rsrc/js/application/diff/DiffPathView.js' => '5f70ad12', 385 + 'rsrc/js/application/diff/DiffTreeView.js' => 'ccf691f3', 386 386 'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17', 387 387 'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd', 388 388 'rsrc/js/application/differential/behavior-populate.js' => 'b86ef6c2', ··· 558 558 'conpherence-thread-manager' => 'aec8e38c', 559 559 'conpherence-transaction-css' => '3a3f5e7e', 560 560 'd3' => '9d068042', 561 - 'diff-tree-view-css' => '8f487a99', 561 + 'diff-tree-view-css' => 'bd83417c', 562 562 'differential-changeset-view-css' => '489b6995', 563 563 'differential-core-view-css' => '7300a73e', 564 564 'differential-revision-add-comment-css' => '7e5900d9', ··· 778 778 'phabricator-diff-changeset' => '2a3101b1', 779 779 'phabricator-diff-changeset-list' => '57035863', 780 780 'phabricator-diff-inline' => '16e97ebc', 781 - 'phabricator-diff-path-view' => 'c0ed32ce', 782 - 'phabricator-diff-tree-view' => 'a5823e4d', 781 + 'phabricator-diff-path-view' => '5f70ad12', 782 + 'phabricator-diff-tree-view' => 'ccf691f3', 783 783 'phabricator-drag-and-drop-file-upload' => '4370900d', 784 784 'phabricator-draggable-list' => '0169e425', 785 785 'phabricator-fatal-config-template-css' => '20babf50', ··· 1517 1517 'javelin-dom', 1518 1518 'phuix-dropdown-menu', 1519 1519 ), 1520 + '5f70ad12' => array( 1521 + 'javelin-dom', 1522 + ), 1520 1523 '5faf27b9' => array( 1521 1524 'phuix-form-control-view', 1522 1525 ), ··· 1869 1872 'javelin-install', 1870 1873 'javelin-dom', 1871 1874 ), 1872 - 'a5823e4d' => array( 1873 - 'javelin-dom', 1874 - ), 1875 1875 'a9942052' => array( 1876 1876 'javelin-behavior', 1877 1877 'javelin-dom', ··· 2035 2035 'c03f2fb4' => array( 2036 2036 'javelin-install', 2037 2037 ), 2038 - 'c0ed32ce' => array( 2039 - 'javelin-dom', 2040 - ), 2041 2038 'c2c500a7' => array( 2042 2039 'javelin-install', 2043 2040 'javelin-dom', ··· 2081 2078 'javelin-util', 2082 2079 'phuix-icon-view', 2083 2080 'phabricator-busy', 2081 + ), 2082 + 'ccf691f3' => array( 2083 + 'javelin-dom', 2084 2084 ), 2085 2085 'cef53b3e' => array( 2086 2086 'javelin-install',
+6 -2
webroot/rsrc/css/application/diff/diff-tree-view.css
··· 8 8 9 9 .diff-tree-path { 10 10 height: 20px; 11 - color: {$greytext}; 12 11 line-height: 20px; 12 + color: {$greytext}; 13 13 } 14 14 15 15 .diff-tree-path-indent { ··· 23 23 text-align: center; 24 24 } 25 25 26 + .diff-tree-path-icon .phui-icon-view { 27 + color: {$greytext}; 28 + } 29 + 26 30 .diff-tree-path-name { 27 - margin-left: 24px; 31 + margin-left: 22px; 28 32 margin-right: 44px; 29 33 white-space: nowrap; 30 34 overflow: hidden;
+44 -3
webroot/rsrc/js/application/diff/DiffPathView.js
··· 21 21 _pathNode: null, 22 22 _changeset: null, 23 23 _inlineNode: null, 24 + _isDirectory: false, 25 + _displayPath: null, 24 26 25 27 getNode: function() { 26 28 if (!this._node) { ··· 45 47 46 48 setPath: function(path) { 47 49 this._path = path; 50 + this._redrawPath(); 51 + return this; 52 + }, 48 53 49 - var display = this._path[this._path.length - 1]; 50 - JX.DOM.setContent(this._getPathNode(), display); 54 + setDisplayPath: function(path) { 55 + this._displayPath = path; 56 + this._redrawPath(); 57 + return this; 58 + }, 51 59 60 + setIsDirectory: function(is_directory) { 61 + this._isDirectory = is_directory; 62 + this._redrawPath(); 52 63 return this; 53 64 }, 54 65 ··· 69 80 return this._path; 70 81 }, 71 82 83 + setHidden: function(hidden) { 84 + this._hidden = hidden; 85 + 86 + var node = this.getNode(); 87 + if (this._hidden) { 88 + JX.DOM.hide(node); 89 + } else { 90 + JX.DOM.show(node); 91 + } 92 + 93 + return this; 94 + }, 95 + 72 96 setDepth: function(depth) { 73 97 this._depth = depth; 74 98 75 - this._getIndentNode().style.marginLeft = (6 * this._depth) + 'px'; 99 + this._getIndentNode().style.marginLeft = (8 * this._depth) + 'px'; 76 100 77 101 return this; 78 102 }, ··· 154 178 this._inlineNode = JX.$N('div', attrs, '-'); 155 179 } 156 180 return this._inlineNode; 181 + }, 182 + 183 + _redrawPath: function() { 184 + var display; 185 + if (this._displayPath) { 186 + display = this._displayPath; 187 + } else { 188 + display = this._path[this._path.length - 1]; 189 + } 190 + 191 + var is_directory = this._isDirectory; 192 + 193 + if (is_directory) { 194 + display = display + '/'; 195 + } 196 + 197 + JX.DOM.setContent(this._getPathNode(), display); 157 198 } 158 199 159 200 }
+75 -3
webroot/rsrc/js/application/diff/DiffTreeView.js
··· 94 94 95 95 // For nodes which don't have a path object yet, build one. 96 96 var tree; 97 + var path; 97 98 var trees = []; 98 99 for (ii = 0; ii < this._keys.length; ii++) { 99 100 var key = this._keys[ii]; 100 101 tree = this._nodes[key]; 101 - var path = tree.pathObject; 102 + path = tree.pathObject; 102 103 103 104 if (!path) { 104 105 path = new JX.DiffPathView() ··· 115 116 116 117 for (ii = 0; ii < trees.length; ii++) { 117 118 tree = trees[ii]; 119 + tree.displayRoot = null; 120 + tree.displayPath = null; 121 + tree.displayHide = false; 122 + } 123 + 124 + var child; 125 + for (ii = 0; ii < trees.length; ii++) { 126 + tree = trees[ii]; 127 + 128 + if (tree.childCount !== 1) { 129 + continue; 130 + } 131 + 132 + for (var k in tree.children) { 133 + if (tree.children.hasOwnProperty(k)) { 134 + child = tree.children[k]; 135 + break; 136 + } 137 + } 138 + 139 + if (child.pathObject.getChangeset()) { 140 + continue; 141 + } 142 + 143 + child.displayRoot = tree.displayRoot || tree; 144 + } 145 + 146 + for (ii = 0; ii < trees.length; ii++) { 147 + tree = trees[ii]; 148 + 149 + if (!tree.displayRoot) { 150 + continue; 151 + } 152 + 153 + if (!tree.displayRoot.displayPath) { 154 + tree.displayRoot.displayPath = [ 155 + tree.displayRoot.parts[tree.displayRoot.parts.length - 1] 156 + ]; 157 + } 158 + 159 + tree.displayRoot.displayPath.push(tree.parts[tree.parts.length - 1]); 160 + tree.displayHide = true; 161 + } 162 + 163 + for (ii = 0; ii < trees.length; ii++) { 164 + tree = trees[ii]; 165 + path = tree.pathObject; 166 + 167 + path.setHidden(!!tree.displayHide); 168 + 169 + if (tree.displayPath) { 170 + path.setDisplayPath(tree.displayPath.join('/')); 171 + } else { 172 + path.setDisplayPath(null); 173 + } 174 + } 175 + 176 + for (ii = 0; ii < trees.length; ii++) { 177 + tree = trees[ii]; 118 178 119 179 if (!tree.parent) { 120 180 tree.depth = 0; 121 181 } else { 122 - tree.depth = tree.parent.depth + 1; 182 + // If this node was collapsed into the parent node, don't increase 183 + // the tree depth. 184 + if (tree.displayHide) { 185 + tree.depth = tree.parent.depth; 186 + } else { 187 + tree.depth = tree.parent.depth + 1; 188 + } 189 + } 190 + 191 + path = tree.pathObject; 192 + 193 + if (tree.childCount > 0) { 194 + path.setIsDirectory(true); 123 195 } 124 196 125 - tree.pathObject.setDepth((tree.depth - 1)); 197 + path.setDepth((tree.depth - 1)); 126 198 } 127 199 128 200 var nodes = [];