Page MenuHomePhabricator

D18747.diff
No OneTemporary

D18747.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -73,7 +73,7 @@
'rsrc/css/application/diffusion/diffusion-icons.css' => '0c15255e',
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
'rsrc/css/application/diffusion/diffusion-repository.css' => 'ee6f20ec',
- 'rsrc/css/application/diffusion/diffusion-source.css' => '3a1056d8',
+ 'rsrc/css/application/diffusion/diffusion-source.css' => 'd96b3f9f',
'rsrc/css/application/diffusion/diffusion.css' => '45727264',
'rsrc/css/application/feed/feed.css' => 'ecd4ec57',
'rsrc/css/application/files/global-drag-and-drop.css' => 'b556a948',
@@ -572,7 +572,7 @@
'diffusion-icons-css' => '0c15255e',
'diffusion-readme-css' => '419dd5b6',
'diffusion-repository-css' => 'ee6f20ec',
- 'diffusion-source-css' => '3a1056d8',
+ 'diffusion-source-css' => 'd96b3f9f',
'diviner-shared-css' => '896f1d43',
'font-fontawesome' => 'e838e088',
'font-lato' => 'c7ccd872',
diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php
--- a/src/applications/diffusion/controller/DiffusionBrowseController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseController.php
@@ -969,6 +969,24 @@
$handles = $viewer->loadHandles($phids);
+ $author_phids = array();
+ $author_map = array();
+ foreach ($blame_commits as $commit) {
+ $commit_identifier = $commit->getCommitIdentifier();
+
+ $author_phid = '';
+ if (isset($revision_map[$commit_identifier])) {
+ $revision_id = $revision_map[$commit_identifier];
+ $revision = $revisions[$revision_id];
+ $author_phid = $revision->getAuthorPHID();
+ } else {
+ $author_phid = $commit->getAuthorPHID();
+ }
+
+ $author_map[$commit_identifier] = $author_phid;
+ $author_phids[$author_phid] = $author_phid;
+ }
+
$colors = array();
if ($blame_commits) {
$epochs = array();
@@ -1113,6 +1131,7 @@
// blame outputs.
$commit_links = $this->renderCommitLinks($blame_commits, $handles);
$revision_links = $this->renderRevisionLinks($revisions, $handles);
+ $author_links = $this->renderAuthorLinks($author_map, $handles);
if ($this->coverage) {
require_celerity_resource('differential-changeset-view-css');
@@ -1145,6 +1164,7 @@
$revision_link = null;
$commit_link = null;
+ $author_link = null;
$before_link = null;
$style = 'background: '.$line['color'].';';
@@ -1152,6 +1172,7 @@
if ($identifier && !$line['duplicate']) {
if (isset($commit_links[$identifier])) {
$commit_link = $commit_links[$identifier];
+ $author_link = $author_links[$author_map[$identifier]];
}
if (isset($revision_map[$identifier])) {
@@ -1185,6 +1206,7 @@
$before_link);
$object_links = array();
+ $object_links[] = $author_link;
$object_links[] = $commit_link;
if ($revision_link) {
$object_links[] = phutil_tag('span', array(), '/');
@@ -1772,6 +1794,33 @@
return array($identifiers, $commits);
}
+ private function renderAuthorLinks(array $authors, $handles) {
+ $links = array();
+
+ foreach ($authors as $phid) {
+ if (!strlen($phid)) {
+ // This means we couldn't identify an author for the commit or the
+ // revision. We just render a blank for alignment.
+ $style = null;
+ $href = null;
+ } else {
+ $src = $handles[$phid]->getImageURI();
+ $style = 'background-image: url('.$src.');';
+ $href = $handles[$phid]->getURI();
+ }
+
+ $links[$phid] = javelin_tag(
+ $href ? 'a' : 'span',
+ array(
+ 'class' => 'diffusion-author-link',
+ 'style' => $style,
+ 'href' => $href,
+ ));
+ }
+
+ return $links;
+ }
+
private function renderCommitLinks(array $commits, $handles) {
$links = array();
foreach ($commits as $identifier => $commit) {
diff --git a/webroot/rsrc/css/application/diffusion/diffusion-source.css b/webroot/rsrc/css/application/diffusion/diffusion-source.css
--- a/webroot/rsrc/css/application/diffusion/diffusion-source.css
+++ b/webroot/rsrc/css/application/diffusion/diffusion-source.css
@@ -66,7 +66,7 @@
.diffusion-rev-link a,
.diffusion-rev-link span {
- margin: 2px 8px 0;
+ margin: 0 8px 0 0;
display: inline-block;
}
@@ -90,3 +90,13 @@
-ms-user-select: none;
user-select: none;
}
+
+.diffusion-rev-link .diffusion-author-link {
+ display: inline-block;
+ padding: 0;
+ margin: 2px 4px -4px 4px;
+ width: 16px;
+ height: 16px;
+ background-size: 100% 100%;
+ background-repeat: no-repeat;
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 9:30 AM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7688909
Default Alt Text
D18747.diff (4 KB)

Event Timeline