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

Clean up file browse view a bit

Summary:
- Use DiffusionCommitQuery
- Get rid of the "Author" column.
- Collapse commit + revision together.
- Better tooltips to cover for the removed information.
- Colorize only the "line" column.
- Generally, reduce the amount of visual noise and non-code-stuff going on in this interface.
- I'd like to make the "<<" thing look nicer too but that might take some actual design.

Test Plan: See screenshots.

Reviewers: btrahan, chad

Reviewed By: chad

CC: chad, aran

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

+95 -64
+1 -1
src/__celerity_resource_map__.php
··· 1154 1154 ), 1155 1155 'diffusion-source-css' => 1156 1156 array( 1157 - 'uri' => '/res/f4a2f867/rsrc/css/application/diffusion/diffusion-source.css', 1157 + 'uri' => '/res/5076c269/rsrc/css/application/diffusion/diffusion-source.css', 1158 1158 'type' => 'css', 1159 1159 'requires' => 1160 1160 array(
+82 -51
src/applications/diffusion/controller/DiffusionBrowseFileController.php
··· 548 548 ++$line_number; 549 549 } 550 550 551 + $request = $this->getRequest(); 552 + $viewer = $request->getUser(); 553 + 551 554 $commits = array_filter(ipull($display, 'commit')); 552 555 if ($commits) { 553 - $commits = id(new PhabricatorAuditCommitQuery()) 554 - ->withIdentifiers($drequest->getRepository()->getID(), $commits) 555 - ->needCommitData(true) 556 + $commits = id(new DiffusionCommitQuery()) 557 + ->setViewer($viewer) 558 + ->withRepositoryIDs(array($drequest->getRepository()->getID())) 559 + ->withIdentifiers($commits) 556 560 ->execute(); 557 561 $commits = mpull($commits, null, 'getCommitIdentifier'); 558 562 } 559 - 560 - $request = $this->getRequest(); 561 - $user = $request->getUser(); 562 563 563 564 $revision_ids = id(new DifferentialRevision()) 564 565 ->loadIDsByCommitPHIDs(mpull($commits, 'getPHID')); 565 566 $revisions = array(); 566 567 if ($revision_ids) { 567 568 $revisions = id(new DifferentialRevisionQuery()) 568 - ->setViewer($user) 569 + ->setViewer($viewer) 569 570 ->withIDs($revision_ids) 570 571 ->execute(); 571 572 } 572 573 574 + $phids = array(); 575 + foreach ($commits as $commit) { 576 + if ($commit->getAuthorPHID()) { 577 + $phids[] = $commit->getAuthorPHID(); 578 + } 579 + } 580 + foreach ($revisions as $revision) { 581 + if ($revision->getAuthorPHID()) { 582 + $phids[] = $revision->getAuthorPHID(); 583 + } 584 + } 585 + $handles = $this->loadViewerHandles($phids); 586 + 573 587 Javelin::initBehavior('phabricator-oncopy', array()); 574 588 575 589 $engine = null; 576 590 $inlines = array(); 577 591 if ($this->getRequest()->getStr('lint') !== null && $this->lintMessages) { 578 592 $engine = new PhabricatorMarkupEngine(); 579 - $engine->setViewer($user); 593 + $engine->setViewer($viewer); 580 594 581 595 foreach ($this->lintMessages as $message) { 582 596 $inline = id(new PhabricatorAuditInlineComment()) ··· 624 638 if (idx($line, 'commit')) { 625 639 $commit = $line['commit']; 626 640 627 - $summary = 'Unknown'; 628 641 if (idx($commits, $commit)) { 629 - $summary = $commits[$commit]->getCommitData()->getSummary(); 642 + $tooltip = $this->renderCommitTooltip( 643 + $commits[$commit], 644 + $handles, 645 + $line['author']); 646 + } else { 647 + $tooltip = null; 630 648 } 631 649 632 - $tooltip = phabricator_date( 633 - $line['epoch'], 634 - $user)." \xC2\xB7 ".$summary; 635 - 636 650 Javelin::initBehavior('phabricator-tooltips', array()); 637 651 require_celerity_resource('aphront-tooltip-css'); 638 652 ··· 660 674 661 675 if ($revision_id) { 662 676 $revision = idx($revisions, $revision_id); 663 - if (!$revision) { 664 - $tooltip = pht('(Invalid revision)'); 665 - } else { 666 - $tooltip = 667 - phabricator_date($revision->getDateModified(), $user). 668 - " \xC2\xB7 ". 669 - $revision->getTitle(); 670 - } 671 - $revision_link = javelin_tag( 672 - 'a', 673 - array( 674 - 'href' => '/D'.$revision_id, 675 - 'sigil' => 'has-tooltip', 676 - 'meta' => array( 677 - 'tip' => $tooltip, 678 - 'align' => 'E', 679 - 'size' => 600, 677 + if ($revision) { 678 + $tooltip = $this->renderRevisionTooltip($revision, $handles); 679 + $revision_link = javelin_tag( 680 + 'a', 681 + array( 682 + 'href' => '/D'.$revision->getID(), 683 + 'sigil' => 'has-tooltip', 684 + 'meta' => array( 685 + 'tip' => $tooltip, 686 + 'align' => 'E', 687 + 'size' => 600, 688 + ), 680 689 ), 681 - ), 682 - 'D'.$revision_id); 690 + 'D'.$revision->getID()); 691 + } 683 692 } 684 693 685 694 $uri = $line_href->alter('before', $commit); ··· 701 710 'th', 702 711 array( 703 712 'class' => 'diffusion-blame-link', 704 - 'style' => $style, 705 713 ), 706 714 $before_link); 707 715 708 - $blame[] = phutil_tag( 709 - 'th', 710 - array( 711 - 'class' => 'diffusion-rev-link', 712 - 'style' => $style, 713 - ), 714 - $commit_link); 716 + $object_links = array(); 717 + $object_links[] = $commit_link; 718 + if ($revision_link) { 719 + $object_links[] = phutil_tag('span', array(), '/'); 720 + $object_links[] = $revision_link; 721 + } 715 722 716 723 $blame[] = phutil_tag( 717 724 'th', 718 725 array( 719 726 'class' => 'diffusion-rev-link', 720 - 'style' => $style, 721 727 ), 722 - $revision_link); 723 - 724 - $blame[] = phutil_tag( 725 - 'th', 726 - array( 727 - 'class' => 'diffusion-author-link', 728 - 'style' => $style, 729 - ), 730 - idx($line, 'author')); 728 + $object_links); 731 729 } 732 730 733 731 $line_link = phutil_tag( 734 732 'a', 735 733 array( 736 734 'href' => $line_href, 735 + 'style' => $style, 737 736 ), 738 737 $line['line']); 739 738 ··· 975 974 'commit' => $commit)); 976 975 977 976 return head($parents); 977 + } 978 + 979 + private function renderRevisionTooltip( 980 + DifferentialRevision $revision, 981 + array $handles) { 982 + $viewer = $this->getRequest()->getUser(); 983 + 984 + $date = phabricator_date($revision->getDateModified(), $viewer); 985 + $id = $revision->getID(); 986 + $title = $revision->getTitle(); 987 + $header = "D{$id} {$title}"; 988 + 989 + $author = $handles[$revision->getAuthorPHID()]->getName(); 990 + 991 + return "{$header}\n{$date} \xC2\xB7 {$author}"; 992 + } 993 + 994 + private function renderCommitTooltip( 995 + PhabricatorRepositoryCommit $commit, 996 + array $handles, 997 + $author) { 998 + 999 + $viewer = $this->getRequest()->getUser(); 1000 + 1001 + $date = phabricator_date($commit->getEpoch(), $viewer); 1002 + $summary = trim($commit->getSummary()); 1003 + 1004 + if ($commit->getAuthorPHID()) { 1005 + $author = $handles[$commit->getAuthorPHID()]->getName(); 1006 + } 1007 + 1008 + return "{$summary}\n{$date} \xC2\xB7 {$author}"; 978 1009 } 979 1010 980 1011 }
+12 -12
webroot/rsrc/css/application/diffusion/diffusion-source.css
··· 37 37 } 38 38 39 39 .diffusion-blame-link, 40 - .diffusion-rev-link, 41 - .diffusion-author-link { 40 + .diffusion-rev-link { 42 41 white-space: nowrap; 43 42 } 44 43 ··· 46 45 min-width: 28px; 47 46 } 48 47 49 - .diffusion-rev-link { 50 - min-width: 90px; 51 - } 52 - 53 - .diffusion-author-link { 54 - min-width: 120px; 48 + .diffusion-source th.diffusion-rev-link { 49 + text-align: left; 50 + min-width: 130px; 55 51 } 56 52 57 53 .diffusion-blame-link a, 58 54 .diffusion-rev-link a, 59 - .diffusion-author-link a, 60 55 .diffusion-line-link a { 61 56 color: {$darkbluetext}; 62 57 } 63 58 64 59 .diffusion-rev-link a, 65 - .diffusion-author-link span, 66 - .diffusion-author-link a { 60 + .diffusion-rev-link span { 67 61 margin: 2px 8px 0; 68 - display: block; 62 + display: inline-block; 63 + } 64 + 65 + .diffusion-rev-link span { 66 + margin-right: -4px; 67 + margin-left: -4px; 68 + color: {$lightgreytext}; 69 69 } 70 70 71 71 .diffusion-blame-link a,