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

Show small author portraits in Diffusion blame view

Summary: Depends on D18746. See PHI174. Adds small author portraits next to each blame line (this is similar to GitHub).

Test Plan:
My local test data isn't that great since I don't have commits from a lot of accounts, but looks functional:

{F5251056}

Reviewers: amckinley

Reviewed By: amckinley

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

+62 -3
+2 -2
resources/celerity/map.php
··· 73 73 'rsrc/css/application/diffusion/diffusion-icons.css' => '0c15255e', 74 74 'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6', 75 75 'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec', 76 - 'rsrc/css/application/diffusion/diffusion-source.css' => '3a1056d8', 76 + 'rsrc/css/application/diffusion/diffusion-source.css' => 'd96b3f9f', 77 77 'rsrc/css/application/diffusion/diffusion.css' => '45727264', 78 78 'rsrc/css/application/feed/feed.css' => 'ecd4ec57', 79 79 'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948', ··· 572 572 'diffusion-icons-css' => '0c15255e', 573 573 'diffusion-readme-css' => '419dd5b6', 574 574 'diffusion-repository-css' => 'ee6f20ec', 575 - 'diffusion-source-css' => '3a1056d8', 575 + 'diffusion-source-css' => 'd96b3f9f', 576 576 'diviner-shared-css' => '896f1d43', 577 577 'font-fontawesome' => 'e838e088', 578 578 'font-lato' => 'c7ccd872',
+49
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 969 969 970 970 $handles = $viewer->loadHandles($phids); 971 971 972 + $author_phids = array(); 973 + $author_map = array(); 974 + foreach ($blame_commits as $commit) { 975 + $commit_identifier = $commit->getCommitIdentifier(); 976 + 977 + $author_phid = ''; 978 + if (isset($revision_map[$commit_identifier])) { 979 + $revision_id = $revision_map[$commit_identifier]; 980 + $revision = $revisions[$revision_id]; 981 + $author_phid = $revision->getAuthorPHID(); 982 + } else { 983 + $author_phid = $commit->getAuthorPHID(); 984 + } 985 + 986 + $author_map[$commit_identifier] = $author_phid; 987 + $author_phids[$author_phid] = $author_phid; 988 + } 989 + 972 990 $colors = array(); 973 991 if ($blame_commits) { 974 992 $epochs = array(); ··· 1113 1131 // blame outputs. 1114 1132 $commit_links = $this->renderCommitLinks($blame_commits, $handles); 1115 1133 $revision_links = $this->renderRevisionLinks($revisions, $handles); 1134 + $author_links = $this->renderAuthorLinks($author_map, $handles); 1116 1135 1117 1136 if ($this->coverage) { 1118 1137 require_celerity_resource('differential-changeset-view-css'); ··· 1145 1164 1146 1165 $revision_link = null; 1147 1166 $commit_link = null; 1167 + $author_link = null; 1148 1168 $before_link = null; 1149 1169 1150 1170 $style = 'background: '.$line['color'].';'; ··· 1152 1172 if ($identifier && !$line['duplicate']) { 1153 1173 if (isset($commit_links[$identifier])) { 1154 1174 $commit_link = $commit_links[$identifier]; 1175 + $author_link = $author_links[$author_map[$identifier]]; 1155 1176 } 1156 1177 1157 1178 if (isset($revision_map[$identifier])) { ··· 1185 1206 $before_link); 1186 1207 1187 1208 $object_links = array(); 1209 + $object_links[] = $author_link; 1188 1210 $object_links[] = $commit_link; 1189 1211 if ($revision_link) { 1190 1212 $object_links[] = phutil_tag('span', array(), '/'); ··· 1770 1792 } 1771 1793 1772 1794 return array($identifiers, $commits); 1795 + } 1796 + 1797 + private function renderAuthorLinks(array $authors, $handles) { 1798 + $links = array(); 1799 + 1800 + foreach ($authors as $phid) { 1801 + if (!strlen($phid)) { 1802 + // This means we couldn't identify an author for the commit or the 1803 + // revision. We just render a blank for alignment. 1804 + $style = null; 1805 + $href = null; 1806 + } else { 1807 + $src = $handles[$phid]->getImageURI(); 1808 + $style = 'background-image: url('.$src.');'; 1809 + $href = $handles[$phid]->getURI(); 1810 + } 1811 + 1812 + $links[$phid] = javelin_tag( 1813 + $href ? 'a' : 'span', 1814 + array( 1815 + 'class' => 'diffusion-author-link', 1816 + 'style' => $style, 1817 + 'href' => $href, 1818 + )); 1819 + } 1820 + 1821 + return $links; 1773 1822 } 1774 1823 1775 1824 private function renderCommitLinks(array $commits, $handles) {
+11 -1
webroot/rsrc/css/application/diffusion/diffusion-source.css
··· 66 66 67 67 .diffusion-rev-link a, 68 68 .diffusion-rev-link span { 69 - margin: 2px 8px 0; 69 + margin: 0 8px 0 0; 70 70 display: inline-block; 71 71 } 72 72 ··· 90 90 -ms-user-select: none; 91 91 user-select: none; 92 92 } 93 + 94 + .diffusion-rev-link .diffusion-author-link { 95 + display: inline-block; 96 + padding: 0; 97 + margin: 2px 4px -4px 4px; 98 + width: 16px; 99 + height: 16px; 100 + background-size: 100% 100%; 101 + background-repeat: no-repeat; 102 + }