@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.

Straighten out the "show more context" stuff.

+118 -28
+11 -1
src/__celerity_resource_map__.php
··· 228 228 ), 229 229 'javelin-behavior-differential-populate' => 230 230 array( 231 - 'uri' => '/res/9982573c/rsrc/js/application/differential/behavior-populate.js', 231 + 'uri' => '/res/f7efbf62/rsrc/js/application/differential/behavior-populate.js', 232 232 'type' => 'js', 233 233 'requires' => 234 234 array( 235 235 0 => 'javelin-lib-dev', 236 236 ), 237 237 'disk' => '/rsrc/js/application/differential/behavior-populate.js', 238 + ), 239 + 'javelin-behavior-differential-show-more' => 240 + array( 241 + 'uri' => '/res/d26ebcae/rsrc/js/application/differential/behavior-show-more.js', 242 + 'type' => 'js', 243 + 'requires' => 244 + array( 245 + 0 => 'javelin-lib-dev', 246 + ), 247 + 'disk' => '/rsrc/js/application/differential/behavior-show-more.js', 238 248 ), 239 249 'javelin-init-dev' => 240 250 array(
+1 -1
src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php
··· 83 83 '$' => 'DifferentialRevisionListController', 84 84 'filter/(?<filter>\w+)/$' => 'DifferentialRevisionListController', 85 85 'diff/(?<id>\d+)/$' => 'DifferentialDiffViewController', 86 - 'changeset/(?<id>\d+)/$' => 'DifferentialChangesetViewController', 86 + 'changeset/$' => 'DifferentialChangesetViewController', 87 87 'revision/edit/(?:(?<id>\d+)/)?$' 88 88 => 'DifferentialRevisionEditController', 89 89 'comment/' => array(
+30 -8
src/applications/differential/controller/changesetview/DifferentialChangesetViewController.php
··· 18 18 19 19 class DifferentialChangesetViewController extends DifferentialController { 20 20 21 - private $id; 22 - 23 - public function willProcessRequest(array $data) { 24 - $this->id = $data['id']; 25 - } 26 21 27 22 public function processRequest() { 28 - $changeset = id(new DifferentialChangeset())->load($this->id); 23 + $request = $this->getRequest(); 24 + 25 + $id = $request->getStr('id'); 26 + 27 + $changeset = id(new DifferentialChangeset())->load($id); 29 28 if (!$changeset) { 30 29 return new Aphront404Response(); 31 30 } 32 31 33 32 $changeset->attachHunks($changeset->loadHunks()); 34 33 34 + $range_s = null; 35 + $range_e = null; 36 + $mask = array(); 37 + 38 + $range = $request->getStr('range'); 39 + if ($range) { 40 + $match = null; 41 + if (preg_match('@^(\d+)-(\d+)(?:/(\d+)-(\d+))?$@', $range, $match)) { 42 + $range_s = (int)$match[1]; 43 + $range_e = (int)$match[2]; 44 + if (count($match) > 3) { 45 + $start = (int)$match[3]; 46 + $len = (int)$match[4]; 47 + for ($ii = $start; $ii < $start + $len; $ii++) { 48 + $mask[$ii] = true; 49 + } 50 + } 51 + } 52 + } 53 + 35 54 $parser = new DifferentialChangesetParser(); 36 55 $parser->setChangeset($changeset); 37 56 38 - $output = $parser->render(); 57 + $output = $parser->render(null, $range_s, $range_e, $mask); 39 58 40 - $request = $this->getRequest(); 41 59 if ($request->isAjax()) { 42 60 return id(new AphrontAjaxResponse()) 43 61 ->setContent($output); 44 62 } 63 + 64 + Javelin::initBehavior('differential-show-more', array( 65 + 'uri' => '/differential/changeset/', 66 + )); 45 67 46 68 $detail = new DifferentialChangesetDetailView(); 47 69 $detail->setChangeset($changeset);
+1
src/applications/differential/controller/changesetview/__init__.php
··· 12 12 phutil_require_module('phabricator', 'applications/differential/parser/changeset'); 13 13 phutil_require_module('phabricator', 'applications/differential/storage/changeset'); 14 14 phutil_require_module('phabricator', 'applications/differential/view/changesetdetailview'); 15 + phutil_require_module('phabricator', 'infrastructure/javelin/api'); 15 16 16 17 phutil_require_module('phutil', 'utils'); 17 18
+25 -12
src/applications/differential/parser/changeset/DifferentialChangesetParser.php
··· 845 845 if ($more) { 846 846 $more = 847 847 ' '. 848 - phutil_render_tag( 848 + javelin_render_tag( 849 849 'a', 850 850 array( 851 851 'mustcapture' => true, 852 852 'sigil' => 'show-more', 853 853 'class' => 'complete', 854 - 'meta' => 'TODO', 854 + 'href' => '#', 855 + 'meta' => array( 856 + 'id' => $changeset_id, 857 + 'range' => "0-{$end}", 858 + ), 855 859 ), 856 860 'Show File Contents'); 857 861 } else { 858 862 $more = null; 859 863 } 860 864 861 - return phutil_render_tag( 865 + return javelin_render_tag( 862 866 'tr', 863 867 array( 864 - 'sigil' => 'contex-target', 868 + 'sigil' => 'context-target', 865 869 ), 866 870 '<td class="differential-shield" colspan="4">'. 867 871 phutil_escape_html($message). ··· 881 885 882 886 $context_not_available = null; 883 887 if ($this->missingOld || $this->missingNew) { 884 - $context_not_available = phutil_render_tag( 888 + $context_not_available = javelin_render_tag( 885 889 'tr', 886 890 array( 887 891 'sigil' => 'context-target', ··· 949 953 $contents = array(); 950 954 951 955 if ($len > 40) { 952 - $contents[] = phutil_render_tag( 956 + $contents[] = javelin_render_tag( 953 957 'a', 954 958 array( 955 959 'href' => '#', 956 960 'mustcapture' => true, 957 961 'sigil' => 'show-more', 958 - 'meta' => '', // TODO 962 + 'meta' => array( 963 + 'id' => $changeset, 964 + 'range' => "{$top}-{$len}/{$top}-20", 965 + ), 959 966 ), 960 967 "\xE2\x96\xB2 Show 20 Lines"); 961 968 } 962 969 963 - $contents[] = phutil_render_tag( 970 + $contents[] = javelin_render_tag( 964 971 'a', 965 972 array( 966 973 'href' => '#', 967 974 'mustcapture' => true, 968 975 'sigil' => 'show-more', 969 - 'meta' => '', // TODO 976 + 'meta' => array( 977 + 'id' => $changeset, 978 + 'range' => "{$top}-{$len}/{$top}-{$len}", 979 + ), 970 980 ), 971 981 'Show All '.$len.' Lines'); 972 982 973 983 if ($len > 40) { 974 - $contents[] = phutil_render_tag( 984 + $contents[] = javelin_render_tag( 975 985 'a', 976 986 array( 977 987 'href' => '#', 978 988 'mustcapture' => true, 979 989 'sigil' => 'show-more', 980 - 'meta' => '', // TODO 990 + 'meta' => array( 991 + 'id' => $changeset, 992 + 'range' => "{$top}-{$len}/{$end}-20", 993 + ), 981 994 ), 982 995 "\xE2\x96\xBC Show 20 Lines"); 983 996 }; 984 997 985 - $container = phutil_render_tag( 998 + $container = javelin_render_tag( 986 999 'tr', 987 1000 array( 988 1001 'sigil' => 'context-target',
+1
src/applications/differential/parser/changeset/__init__.php
··· 13 13 phutil_require_module('phabricator', 'applications/differential/storage/changeset'); 14 14 phutil_require_module('phabricator', 'applications/differential/storage/diff'); 15 15 phutil_require_module('phabricator', 'applications/files/uri'); 16 + phutil_require_module('phabricator', 'infrastructure/javelin/markup'); 16 17 phutil_require_module('phabricator', 'storage/queryfx'); 17 18 18 19 phutil_require_module('phutil', 'filesystem');
+5 -3
src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php
··· 66 66 'whitespace' => $whitespace, 67 67 )); 68 68 */ 69 - $detail_uri = '/differential/changeset/'.$changeset->getID().'/'; 69 + $detail_uri = '/differential/changeset/?id='.$changeset->getID(); 70 70 71 71 $detail_button = phutil_render_tag( 72 72 'a', ··· 99 99 Javelin::initBehavior('differential-populate', array( 100 100 'registry' => $mapping, 101 101 'whitespace' => $whitespace, 102 - 'uri' => '/differential/changeset/',//$render_uri, 102 + 'uri' => '/differential/changeset/', 103 103 )); 104 104 105 - 105 + Javelin::initBehavior('differential-show-more', array( 106 + 'uri' => '/differential/changeset/', 107 + )); 106 108 /* 107 109 108 110
+2 -3
webroot/rsrc/js/application/differential/behavior-populate.js
··· 9 9 JX.DOM.replace(JX.$(target), JX.HTML(response)); 10 10 } 11 11 12 - var uri; 13 12 for (var k in config.registry) { 14 - uri = config.uri + config.registry[k][0] + '/'; 15 - new JX.Request(uri, JX.bind(null, onresponse, k)) 13 + new JX.Request(config.uri, JX.bind(null, onresponse, k)) 16 14 .setData({ 15 + id: config.registry[k][0], 17 16 against: config.registry[k][1], 18 17 whitespace: config.whitespace 19 18 })
+42
webroot/rsrc/js/application/differential/behavior-show-more.js
··· 1 + /** 2 + * @provides javelin-behavior-differential-show-more 3 + * @requires javelin-lib-dev 4 + */ 5 + 6 + JX.behavior('differential-show-more', function(config) { 7 + 8 + function onresponse(origin, response) { 9 + var div = JX.$N('div', {}, JX.HTML(response)); 10 + var anchor = origin.getNode('context-target'); 11 + var root = anchor.parentNode; 12 + copyRows(root, div, anchor); 13 + root.removeChild(anchor); 14 + } 15 + 16 + JX.Stratcom.listen( 17 + 'click', 18 + 'show-more', 19 + function(e) { 20 + var context = e.getNodes()['context-target']; 21 + var container = JX.DOM.find(context, 'td'); 22 + JX.DOM.setContent(container, 'Loading...'); 23 + JX.DOM.alterClass(context, 'differential-show-more-loading', true); 24 + var data = e.getData()['show-more']; 25 + new JX.Request(config.uri, JX.bind(null, onresponse, e)) 26 + .setData(data) 27 + .send(); 28 + e.kill(); 29 + }); 30 + 31 + }); 32 + 33 + function copyRows(dst, src, before) { 34 + var rows = JX.DOM.scry(src, 'tr'); 35 + for (var ii = 0; ii < rows.length; ii++) { 36 + if (before) { 37 + dst.insertBefore(rows[ii], before); 38 + } else { 39 + dst.appendChild(rows[ii]); 40 + } 41 + } 42 + }