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

Diffusion: turn branches/refs properties into links

Summary: They just beg to be clicked.

Test Plan: clicked furiously with my mouse until i got tired - went expected places.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

authored by

David Reuss and committed by
epriestley
30b06c1a aa95ef24

+49 -9
+49 -9
src/applications/diffusion/controller/DiffusionCommitController.php
··· 361 361 362 362 $request = $this->getDiffusionRequest(); 363 363 364 - $contains = DiffusionContainsQuery::newFromDiffusionRequest($request); 365 - $branches = $contains->loadContainingBranches(); 366 - 364 + $branches = $this->buildBranches($request); 367 365 if ($branches) { 368 - // TODO: Separate these into 'tracked' and other; link tracked branches. 369 - $branches = implode(', ', array_keys($branches)); 370 - $branches = phutil_escape_html($branches); 371 366 $props['Branches'] = $branches; 372 367 } 373 - 374 368 375 369 $tags = $this->buildTags($request); 376 370 if ($tags) { ··· 379 373 380 374 $refs = $this->buildRefs($request); 381 375 if ($refs) { 382 - $props['Refs'] = $refs; 376 + $props['References'] = $refs; 383 377 } 384 378 385 379 if ($task_phids) { ··· 761 755 return $action_list; 762 756 } 763 757 758 + private function buildBranches(DiffusionRequest $request) { 759 + 760 + $branch_query = DiffusionContainsQuery::newFromDiffusionRequest($request); 761 + $branches = $branch_query->loadContainingBranches(); 762 + 763 + if (!$branches) { 764 + return null; 765 + } 766 + 767 + $branch_links = array(); 768 + foreach ($branches as $branch => $commit) { 769 + $branch_links[] = phutil_render_tag( 770 + 'a', 771 + array( 772 + 'href' => $request->generateURI( 773 + array( 774 + 'action' => 'browse', 775 + 'branch' => $branch, 776 + )), 777 + ), 778 + phutil_escape_html($branch)); 779 + } 780 + $branch_links = implode(', ', $branch_links); 781 + return $branch_links; 782 + } 783 + 764 784 private function buildTags(DiffusionRequest $request) { 765 785 $tag_limit = 10; 766 786 ··· 822 842 '%d', 823 843 $request->getCommit()); 824 844 825 - return trim($stdout, "() \n"); 845 + // %d, gives a weird output format 846 + // similar to (remote/one, remote/two, remote/three) 847 + $refs = trim($stdout, "() \n"); 848 + $refs = explode(',', $refs); 849 + $refs = array_map('trim', $refs); 850 + 851 + $ref_links = array(); 852 + foreach ($refs as $ref) { 853 + $ref_links[] = phutil_render_tag( 854 + 'a', 855 + array( 856 + 'href' => $request->generateURI( 857 + array( 858 + 'action' => 'browse', 859 + 'branch' => $ref, 860 + )), 861 + ), 862 + phutil_escape_html($ref)); 863 + } 864 + $ref_links = implode(', ', $ref_links); 865 + return $ref_links; 826 866 } 827 867 828 868 private function buildRawDiffResponse(DiffusionRequest $drequest) {