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

Remove the ability to disable blame in Diffusion

Summary: Ref T13105. Given that we now load blame with AJAX, it's not clear that there's any benefit to disabling it. This would also interact oddly with the document engine.

Test Plan: Viewed files in Diffusion, no longer saw blame-related options.

Reviewers: mydeveloperday

Reviewed By: mydeveloperday

Maniphest Tasks: T13105

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

+29 -95
+29 -95
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 111 111 112 112 $path = $drequest->getPath(); 113 113 114 - $blame_key = PhabricatorDiffusionBlameSetting::SETTINGKEY; 115 - $show_blame = $request->getBool( 116 - 'blame', 117 - $viewer->getUserSetting($blame_key)); 118 - 119 - $view = $request->getStr('view'); 120 - if ($request->isFormPost() && $view != 'raw' && $viewer->isLoggedIn()) { 121 - $preferences = PhabricatorUserPreferences::loadUserPreferences($viewer); 122 - 123 - $editor = id(new PhabricatorUserPreferencesEditor()) 124 - ->setActor($viewer) 125 - ->setContentSourceFromRequest($request) 126 - ->setContinueOnNoEffect(true) 127 - ->setContinueOnMissingFields(true); 128 - 129 - $xactions = array(); 130 - $xactions[] = $preferences->newTransaction($blame_key, $show_blame); 131 - $editor->applyTransactions($preferences, $xactions); 132 - 133 - $uri = $request->getRequestURI() 134 - ->alter('blame', null); 135 - 136 - return id(new AphrontRedirectResponse())->setURI($uri); 137 - } 138 - 139 114 // We need the blame information if blame is on and this is an Ajax request. 140 115 // If blame is on and this is a colorized request, we don't show blame at 141 116 // first (we ajax it in afterward) so we don't need to query for it. 142 - $needs_blame = ($show_blame && $request->isAjax()); 117 + $needs_blame = $request->isAjax(); 143 118 144 119 $params = array( 145 120 'commit' => $drequest->getCommit(), 146 121 'path' => $drequest->getPath(), 147 122 ); 123 + 124 + $view = $request->getStr('view'); 148 125 149 126 $byte_limit = null; 150 127 if ($view !== 'raw') { ··· 225 202 226 203 // Build the content of the file. 227 204 $corpus = $this->buildCorpus( 228 - $show_blame, 229 205 $data, 230 206 $needs_blame, 231 207 $drequest, ··· 240 216 241 217 require_celerity_resource('diffusion-source-css'); 242 218 243 - // Render the page. 244 - $bar = $this->buildButtonBar($drequest, $show_blame, $show_editor); 219 + $bar = $this->buildButtonBar($drequest, $show_editor); 245 220 $header = $this->buildHeaderView($drequest); 246 221 $header->setHeaderIcon('fa-file-code-o'); 247 222 ··· 540 515 } 541 516 542 517 private function buildCorpus( 543 - $show_blame, 544 518 $file_corpus, 545 519 $needs_blame, 546 520 DiffusionRequest $drequest, ··· 585 559 $rows = $this->buildDisplayRows( 586 560 $lines, 587 561 $blame_list, 588 - $blame_commits, 589 - $show_blame); 562 + $blame_commits); 590 563 591 564 $corpus_table = javelin_tag( 592 565 'table', ··· 677 650 phutil_format_bytes($highlight_limit)); 678 651 } 679 652 680 - if ($show_blame && !$can_blame) { 653 + if (!$can_blame) { 681 654 $messages[] = pht( 682 655 'This file is larger than %s, so blame is disabled.', 683 656 phutil_format_bytes($blame_limit)); ··· 701 674 702 675 private function buildButtonBar( 703 676 DiffusionRequest $drequest, 704 - $show_blame, 705 677 $show_editor) { 706 678 707 679 $viewer = $this->getViewer(); ··· 728 700 ))) 729 701 ->setIcon('fa-backward'); 730 702 731 - if ($show_blame) { 732 - $blame_text = pht('Disable Blame'); 733 - $blame_icon = 'fa-exclamation-circle lightgreytext'; 734 - $blame_value = 0; 735 - } else { 736 - $blame_text = pht('Enable Blame'); 737 - $blame_icon = 'fa-exclamation-circle'; 738 - $blame_value = 1; 739 - } 740 - 741 - $blame = id(new PHUIButtonView()) 742 - ->setText($blame_text) 743 - ->setIcon($blame_icon) 744 - ->setUser($viewer) 745 - ->setSelected(!$blame_value) 746 - ->setColor(PHUIButtonView::GREY); 747 - 748 - if ($viewer->isLoggedIn()) { 749 - $blame = phabricator_form( 750 - $viewer, 751 - array( 752 - 'action' => $base_uri->alter('blame', $blame_value), 753 - 'method' => 'POST', 754 - 'style' => 'display: inline-block;', 755 - ), 756 - $blame); 757 - } else { 758 - $blame->setTag('a'); 759 - $blame->setHref($base_uri->alter('blame', $blame_value)); 760 - } 761 - $buttons[] = $blame; 762 - 763 703 if ($editor_link) { 764 704 $buttons[] = 765 705 id(new PHUIButtonView()) ··· 931 871 private function buildDisplayRows( 932 872 array $lines, 933 873 array $blame_list, 934 - array $blame_commits, 935 - $show_blame) { 874 + array $blame_commits) { 936 875 937 876 $request = $this->getRequest(); 938 877 $viewer = $this->getViewer(); ··· 1123 1062 1124 1063 $rows = $this->renderInlines( 1125 1064 idx($inlines, 0, array()), 1126 - $show_blame, 1127 1065 (bool)$this->coverage, 1128 1066 $engine); 1129 1067 ··· 1157 1095 1158 1096 $skip_text = pht('Skip Past This Commit'); 1159 1097 $skip_icon = id(new PHUIIconView()) 1160 - ->setIcon('fa-caret-square-o-left'); 1098 + ->setIcon('fa-backward'); 1161 1099 1162 1100 foreach ($display as $line_index => $line) { 1163 1101 $row = array(); ··· 1191 1129 } 1192 1130 } 1193 1131 1194 - $skip_href = $line_href.'?before='.$identifier.'&view=blame'; 1132 + $skip_href = $line_href.'?before='.$identifier; 1195 1133 $before_link = javelin_tag( 1196 1134 'a', 1197 1135 array( ··· 1206 1144 $skip_icon); 1207 1145 } 1208 1146 1209 - if ($show_blame) { 1210 - $row[] = phutil_tag( 1211 - 'th', 1212 - array( 1213 - 'class' => 'diffusion-blame-link', 1214 - ), 1215 - $before_link); 1216 - 1217 - $object_links = array(); 1218 - $object_links[] = $author_link; 1219 - $object_links[] = $commit_link; 1220 - if ($revision_link) { 1221 - $object_links[] = phutil_tag('span', array(), '/'); 1222 - $object_links[] = $revision_link; 1223 - } 1147 + $row[] = phutil_tag( 1148 + 'th', 1149 + array( 1150 + 'class' => 'diffusion-blame-link', 1151 + ), 1152 + $before_link); 1224 1153 1225 - $row[] = phutil_tag( 1226 - 'th', 1227 - array( 1228 - 'class' => 'diffusion-rev-link', 1229 - ), 1230 - $object_links); 1154 + $object_links = array(); 1155 + $object_links[] = $author_link; 1156 + $object_links[] = $commit_link; 1157 + if ($revision_link) { 1158 + $object_links[] = phutil_tag('span', array(), '/'); 1159 + $object_links[] = $revision_link; 1231 1160 } 1161 + 1162 + $row[] = phutil_tag( 1163 + 'th', 1164 + array( 1165 + 'class' => 'diffusion-rev-link', 1166 + ), 1167 + $object_links); 1232 1168 1233 1169 $line_link = phutil_tag( 1234 1170 'a', ··· 1305 1241 1306 1242 $cur_inlines = $this->renderInlines( 1307 1243 idx($inlines, $line_number, array()), 1308 - $show_blame, 1309 1244 $this->coverage, 1310 1245 $engine); 1311 1246 foreach ($cur_inlines as $cur_inline) { ··· 1318 1253 1319 1254 private function renderInlines( 1320 1255 array $inlines, 1321 - $show_blame, 1322 1256 $has_coverage, 1323 1257 $engine) { 1324 1258 ··· 1333 1267 ->setInlineComment($inline) 1334 1268 ->render(); 1335 1269 1336 - $row = array_fill(0, ($show_blame ? 3 : 1), phutil_tag('th')); 1270 + $row = array_fill(0, 3, phutil_tag('th')); 1337 1271 1338 1272 $row[] = phutil_tag('td', array(), $inline_view); 1339 1273