@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 audit status with PHUIStatusListView instead of enormous xbox-sized table

Summary: Replace giant table with PHUIStatusListView. Also remove "MetaMTA Transcripts" (which doesn't work any more) and "Herald Transcripts" (which no one uses).

Test Plan:
{F51437}

{F51438}

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

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

+99 -60
+1 -1
src/__celerity_resource_map__.php
··· 3875 3875 ), 3876 3876 'phui-status-list-view-css' => 3877 3877 array( 3878 - 'uri' => '/res/a91b3fbe/rsrc/css/phui/phui-status.css', 3878 + 'uri' => '/res/edd24959/rsrc/css/phui/phui-status.css', 3879 3879 'type' => 'css', 3880 3880 'requires' => 3881 3881 array(
+94 -56
src/applications/diffusion/controller/DiffusionCommitController.php
··· 52 52 ->setAnchorName('top') 53 53 ->setNavigationMarker(true); 54 54 55 + $audit_requests = id(new PhabricatorAuditQuery()) 56 + ->withCommitPHIDs(array($commit->getPHID())) 57 + ->execute(); 58 + $this->auditAuthorityPHIDs = 59 + PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user); 60 + 61 + 55 62 $is_foreign = $commit_data->getCommitDetail('foreign-svn-stub'); 56 63 $changesets = null; 57 64 if ($is_foreign) { ··· 86 93 $commit_properties = $this->loadCommitProperties( 87 94 $commit, 88 95 $commit_data, 89 - $parents); 96 + $parents, 97 + $audit_requests); 90 98 $property_list = id(new PhabricatorPropertyListView()) 91 99 ->setHasKeyboardShortcuts(true) 92 100 ->setUser($user) ··· 116 124 $content[] = $property_list; 117 125 } 118 126 119 - $query = new PhabricatorAuditQuery(); 120 - $query->withCommitPHIDs(array($commit->getPHID())); 121 - $audit_requests = $query->execute(); 122 - 123 - $this->auditAuthorityPHIDs = 124 - PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user); 125 - 126 - $content[] = $this->buildAuditTable($commit, $audit_requests); 127 127 $content[] = $this->buildComments($commit); 128 128 129 129 $hard_limit = 1000; ··· 368 368 private function loadCommitProperties( 369 369 PhabricatorRepositoryCommit $commit, 370 370 PhabricatorRepositoryCommitData $data, 371 - array $parents) { 371 + array $parents, 372 + array $audit_requests) { 372 373 373 374 assert_instances_of($parents, 'PhabricatorRepositoryCommit'); 374 375 $user = $this->getRequest()->getUser(); ··· 418 419 if ($commit->getAuditStatus()) { 419 420 $status = PhabricatorAuditCommitStatusConstants::getStatusName( 420 421 $commit->getAuditStatus()); 421 - $props['Status'] = phutil_tag( 422 - 'strong', 423 - array(), 424 - $status); 422 + $tag = id(new PhabricatorTagView()) 423 + ->setType(PhabricatorTagView::TYPE_STATE) 424 + ->setName($status); 425 + 426 + switch ($commit->getAuditStatus()) { 427 + case PhabricatorAuditCommitStatusConstants::NEEDS_AUDIT: 428 + $tag->setBackgroundColor(PhabricatorTagView::COLOR_ORANGE); 429 + break; 430 + case PhabricatorAuditCommitStatusConstants::CONCERN_RAISED: 431 + $tag->setBackgroundColor(PhabricatorTagView::COLOR_RED); 432 + break; 433 + case PhabricatorAuditCommitStatusConstants::PARTIALLY_AUDITED: 434 + $tag->setBackgroundColor(PhabricatorTagView::COLOR_BLUE); 435 + break; 436 + case PhabricatorAuditCommitStatusConstants::FULLY_AUDITED: 437 + $tag->setBackgroundColor(PhabricatorTagView::COLOR_GREEN); 438 + break; 439 + } 440 + 441 + $props['Status'] = $tag; 442 + } 443 + 444 + if ($audit_requests) { 445 + $props['Auditors'] = $this->renderAuditStatusView($audit_requests); 425 446 } 426 447 427 448 $props['Committed'] = phabricator_datetime($commit->getEpoch(), $user); ··· 510 531 return $props; 511 532 } 512 533 513 - private function buildAuditTable( 514 - PhabricatorRepositoryCommit $commit, 515 - array $audits) { 516 - assert_instances_of($audits, 'PhabricatorRepositoryAuditRequest'); 517 - $user = $this->getRequest()->getUser(); 518 - 519 - $view = new PhabricatorAuditListView(); 520 - $view->setAudits($audits); 521 - $view->setCommits(array($commit)); 522 - $view->setUser($user); 523 - $view->setShowCommits(false); 524 - 525 - $phids = $view->getRequiredHandlePHIDs(); 526 - $handles = $this->loadViewerHandles($phids); 527 - $view->setHandles($handles); 528 - $view->setAuthorityPHIDs($this->auditAuthorityPHIDs); 529 - $this->highlightedAudits = $view->getHighlightedAudits(); 530 - 531 - $panel = new AphrontPanelView(); 532 - $panel->setHeader(pht('Audits')); 533 - $panel->setCaption(pht('Audits you are responsible for are highlighted.')); 534 - $panel->appendChild($view); 535 - $panel->setNoBackground(); 536 - 537 - return $panel; 538 - } 539 - 540 534 private function buildComments(PhabricatorRepositoryCommit $commit) { 541 535 $user = $this->getRequest()->getUser(); 542 536 $comments = id(new PhabricatorAuditComment())->loadAllWhere( ··· 886 880 $actions->addAction($action); 887 881 } 888 882 889 - if ($user->getIsAdmin()) { 890 - $action = id(new PhabricatorActionView()) 891 - ->setName(pht('MetaMTA Transcripts')) 892 - ->setIcon('file') 893 - ->setHref('/mail/?phid='.$commit->getPHID()); 894 - $actions->addAction($action); 895 - } 896 - 897 - $action = id(new PhabricatorActionView()) 898 - ->setName(pht('Herald Transcripts')) 899 - ->setIcon('file') 900 - ->setHref('/herald/transcript/?phid='.$commit->getPHID()) 901 - ->setWorkflow(true); 902 - $actions->addAction($action); 903 - 904 883 $action = id(new PhabricatorActionView()) 905 884 ->setName(pht('Download Raw Diff')) 906 885 ->setHref($request->getRequestURI()->alter('diff', true)) ··· 945 924 )); 946 925 947 926 return id(new AphrontRedirectResponse())->setURI($file->getBestURI()); 927 + } 928 + 929 + private function renderAuditStatusView(array $audit_requests) { 930 + assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest'); 931 + 932 + $phids = mpull($audit_requests, 'getAuditorPHID'); 933 + $this->loadHandles($phids); 934 + 935 + $authority_map = array_fill_keys($this->auditAuthorityPHIDs, true); 936 + 937 + $view = new PHUIStatusListView(); 938 + foreach ($audit_requests as $request) { 939 + $item = new PHUIStatusItemView(); 940 + 941 + switch ($request->getAuditStatus()) { 942 + case PhabricatorAuditStatusConstants::AUDIT_NOT_REQUIRED: 943 + $item->setIcon('open-blue', pht('Commented')); 944 + break; 945 + case PhabricatorAuditStatusConstants::AUDIT_REQUIRED: 946 + $item->setIcon('warning-blue', pht('Audit Required')); 947 + break; 948 + case PhabricatorAuditStatusConstants::CONCERNED: 949 + $item->setIcon('reject-red', pht('Concern Raised')); 950 + break; 951 + case PhabricatorAuditStatusConstants::ACCEPTED: 952 + $item->setIcon('accept-green', pht('Accepted')); 953 + break; 954 + case PhabricatorAuditStatusConstants::AUDIT_REQUESTED: 955 + $item->setIcon('warning-dark', pht('Audit Requested')); 956 + break; 957 + case PhabricatorAuditStatusConstants::RESIGNED: 958 + $item->setIcon('open-dark', pht('Accepted')); 959 + break; 960 + case PhabricatorAuditStatusConstants::CLOSED: 961 + $item->setIcon('accept-blue', pht('Accepted')); 962 + break; 963 + case PhabricatorAuditStatusConstants::CC: 964 + $item->setIcon('info-dark', pht('Subscribed')); 965 + break; 966 + } 967 + 968 + $note = array(); 969 + foreach ($request->getAuditReasons() as $reason) { 970 + $note[] = phutil_tag('div', array(), $reason); 971 + } 972 + $item->setNote($note); 973 + 974 + $auditor_phid = $request->getAuditorPHID(); 975 + $target = $this->getHandle($auditor_phid)->renderLink(); 976 + $item->setTarget($target); 977 + 978 + if (isset($authority_map[$auditor_phid])) { 979 + $item->setHighlighted(true); 980 + } 981 + 982 + $view->addItem($item); 983 + } 984 + 985 + return $view; 948 986 } 949 987 950 988 }
+4 -3
webroot/rsrc/css/phui/phui-status.css
··· 10 10 display: block; 11 11 width: 14px; 12 12 height: 14px; 13 - margin: 4px 4px; 13 + margin: 3px 4px; 14 14 } 15 15 16 16 .phui-status-item-target { 17 17 padding: 0 12px 0 4px; 18 - line-height: 22px; 18 + line-height: 20px; 19 19 white-space: nowrap; 20 20 } 21 21 22 22 .phui-status-item-note { 23 23 width: 100%; 24 24 color: #666666; 25 - line-height: 22px; 25 + line-height: 14px; 26 + padding: 3px 0; 26 27 } 27 28 28 29 .phui-status-item-highlighted {