@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 lines 12, 13, 14, etc all blame to the same change, only show it once

Summary:
Depends on D19312. Ref T13105. For readability, render only one link for each contiguous block of changes.

Also make the actual rendering logic a little more defensible.

Test Plan: Viewed some files with blame, saw one render per chunk instead of one per line.

Maniphest Tasks: T13105

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

+59 -42
+7 -7
resources/celerity/map.php
··· 390 390 'rsrc/js/application/diffusion/behavior-pull-lastmodified.js' => 'f01586dc', 391 391 'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => '1db13e70', 392 392 'rsrc/js/application/drydock/drydock-live-operation-status.js' => '901935ef', 393 - 'rsrc/js/application/files/behavior-document-engine.js' => 'ed539253', 393 + 'rsrc/js/application/files/behavior-document-engine.js' => '6760beb4', 394 394 'rsrc/js/application/files/behavior-icon-composer.js' => '8499b6ab', 395 395 'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888', 396 396 'rsrc/js/application/harbormaster/behavior-harbormaster-log.js' => '191b4909', ··· 604 604 'javelin-behavior-diffusion-jump-to' => '73d09eef', 605 605 'javelin-behavior-diffusion-locate-file' => '6d3e1947', 606 606 'javelin-behavior-diffusion-pull-lastmodified' => 'f01586dc', 607 - 'javelin-behavior-document-engine' => 'ed539253', 607 + 'javelin-behavior-document-engine' => '6760beb4', 608 608 'javelin-behavior-doorkeeper-tag' => '1db13e70', 609 609 'javelin-behavior-drydock-live-operation-status' => '901935ef', 610 610 'javelin-behavior-durable-column' => '2ae077e1', ··· 1398 1398 'javelin-json', 1399 1399 'phuix-form-control-view', 1400 1400 ), 1401 + '6760beb4' => array( 1402 + 'javelin-behavior', 1403 + 'javelin-dom', 1404 + 'javelin-stratcom', 1405 + ), 1401 1406 '680ea2c8' => array( 1402 1407 'javelin-install', 1403 1408 'javelin-dom', ··· 2115 2120 'javelin-dom', 2116 2121 'javelin-stratcom', 2117 2122 'javelin-vector', 2118 - ), 2119 - 'ed539253' => array( 2120 - 'javelin-behavior', 2121 - 'javelin-dom', 2122 - 'javelin-stratcom', 2123 2123 ), 2124 2124 'edf8a145' => array( 2125 2125 'javelin-behavior',
+3 -2
src/view/layout/PhabricatorSourceCodeView.php
··· 130 130 $lines = idx($blame_map, $line_number); 131 131 132 132 if ($lines) { 133 - $skip_blame = 'skip;'.$lines; 134 - $info_blame = 'info;'.$lines; 133 + $skip_blame = 'skip'; 134 + $info_blame = 'info'; 135 135 } else { 136 136 $skip_blame = null; 137 137 $info_blame = null; ··· 149 149 array( 150 150 'class' => 'phabricator-source-blame-info', 151 151 'data-blame' => $info_blame, 152 + 'data-blame-lines' => $lines, 152 153 )), 153 154 ); 154 155 } else {
+49 -33
webroot/rsrc/js/application/files/behavior-document-engine.js
··· 239 239 // We're ready to render. 240 240 var viewport = JX.$(data.viewportID); 241 241 242 - var cells = JX.DOM.scry(viewport, 'th'); 242 + var row_nodes = JX.DOM.scry(viewport, 'tr'); 243 + var row_list = []; 244 + var ii; 245 + 246 + for (ii = 0; ii < row_nodes.length; ii++) { 247 + var row = {}; 248 + var keep = false; 249 + var node = row_nodes[ii]; 243 250 244 - for (var ii = 0; ii < cells.length; ii++) { 245 - var cell = cells[ii]; 251 + for (var jj = 0; jj < node.childNodes.length; jj++) { 252 + var child = node.childNodes[jj]; 246 253 247 - var spec = cell.getAttribute('data-blame'); 248 - if (!spec) { 249 - continue; 250 - } 254 + if (!JX.DOM.isType(child, 'th')) { 255 + continue; 256 + } 251 257 252 - spec = spec.split(';'); 253 - var type = spec[0]; 254 - var lines = spec[1]; 258 + var spec = child.getAttribute('data-blame'); 259 + if (spec) { 260 + row[spec] = child; 261 + keep = true; 262 + } 255 263 256 - var content = null; 257 - switch (type) { 258 - case 'skip': 259 - content = renderSkip(data.blame.value, lines); 260 - break; 261 - case 'info': 262 - content = renderInfo(data.blame.value, lines); 263 - break; 264 + if (spec === 'info') { 265 + row.lines = child.getAttribute('data-blame-lines'); 266 + } 264 267 } 265 268 266 - JX.DOM.setContent(cell, content); 269 + if (keep) { 270 + row_list.push(row); 271 + } 272 + } 273 + 274 + var last = null; 275 + for (ii = 0; ii < row_list.length; ii++) { 276 + var commit = data.blame.value.blame[row_list[ii].lines - 1]; 277 + row_list[ii].commit = commit; 278 + row_list[ii].last = last; 279 + last = commit; 280 + } 281 + 282 + for (ii = 0; ii < row_list.length; ii++) { 283 + renderBlame(row_list[ii], data.blame.value); 267 284 } 268 285 } 269 286 ··· 273 290 blame(data); 274 291 } 275 292 276 - function renderSkip(blame, lines) { 277 - var commit = blame.blame[lines - 1]; 278 - if (!commit) { 279 - return null; 280 - } 293 + function renderBlame(row, blame) { 294 + var spec = blame.map[row.commit]; 281 295 282 - var spec = blame.map[commit]; 283 296 284 - return JX.$H(spec.skip); 285 - } 297 + var info = null; 298 + var skip = null; 286 299 287 - function renderInfo(blame, lines) { 288 - var commit = blame.blame[lines - 1]; 289 - if (!commit) { 290 - return null; 300 + if (spec && (row.commit != row.last)) { 301 + skip = JX.$H(spec.skip); 302 + info = JX.$H(spec.info); 291 303 } 292 304 293 - var spec = blame.map[commit]; 305 + if (row.skip) { 306 + JX.DOM.setContent(row.skip, skip); 307 + } 294 308 295 - return JX.$H(spec.info); 309 + if (row.info) { 310 + JX.DOM.setContent(row.info, info); 311 + } 296 312 } 297 313 298 314 if (!statics.initialized) {