From e66a03eaa3e4c62f22e8e6a62fd98f134ea85466 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 12 Jan 2017 12:56:10 -0800 Subject: [PATCH] In Audit list and Owners list, show overall commit audit status instead of semi-viewer status Summary: Fixes T9482. Historically, Audit was somewhat confused about whether queries and views should act on the viewer's status or the object's status. This realigns Audit to work like Differential: we show overall status for the commit, just like we show overall status for revisions. This better aligns with expectation and isn't weird/confusing, and bucketing should handle all the "what do //I// need to do" stuff now (or, at least, seems to have in Differential). This is also how every other type of object works in every other application, AFAIK (all of them show object status, not viewer's-relationship-to-the-object status). Test Plan: - Viewed commit lists in Owners and Audit. - Saw commit overall statuses, not my personal status. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9482 Differential Revision: https://secure.phabricator.com/D17195 --- .../query/PhabricatorCommitSearchEngine.php | 6 +-- .../audit/view/PhabricatorAuditListView.php | 40 +++++-------------- 2 files changed, 11 insertions(+), 35 deletions(-) diff --git a/src/applications/audit/query/PhabricatorCommitSearchEngine.php b/src/applications/audit/query/PhabricatorCommitSearchEngine.php index c6c37208f8..fa4fa3c963 100644 --- a/src/applications/audit/query/PhabricatorCommitSearchEngine.php +++ b/src/applications/audit/query/PhabricatorCommitSearchEngine.php @@ -139,12 +139,8 @@ final class PhabricatorCommitSearchEngine $bucket = $this->getResultBucket($query); - $authority_phids = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser( - $viewer); - $template = id(new PhabricatorAuditListView()) - ->setViewer($viewer) - ->setAuthorityPHIDs($authority_phids); + ->setViewer($viewer); $views = array(); if ($bucket) { diff --git a/src/applications/audit/view/PhabricatorAuditListView.php b/src/applications/audit/view/PhabricatorAuditListView.php index c359833729..f348acc759 100644 --- a/src/applications/audit/view/PhabricatorAuditListView.php +++ b/src/applications/audit/view/PhabricatorAuditListView.php @@ -3,16 +3,10 @@ final class PhabricatorAuditListView extends AphrontView { private $commits; - private $authorityPHIDs = array(); private $header; private $noDataString; private $highlightedAudits; - public function setAuthorityPHIDs(array $phids) { - $this->authorityPHIDs = $phids; - return $this; - } - public function setNoDataString($no_data_string) { $this->noDataString = $no_data_string; return $this; @@ -101,28 +95,15 @@ final class PhabricatorAuditListView extends AphrontView { } $auditors = phutil_implode_html(', ', $auditors); - $authority_audits = array_select_keys($audits, $this->authorityPHIDs); - if ($authority_audits) { - $audit = reset($authority_audits); - } else { - $audit = reset($audits); - } - if ($audit) { - $reasons = $audit->getAuditReasons(); - $reasons = phutil_implode_html(', ', $reasons); - $status_code = $audit->getAuditStatus(); - $status_text = - PhabricatorAuditStatusConstants::getStatusName($status_code); - $status_color = - PhabricatorAuditStatusConstants::getStatusColor($status_code); - $status_icon = - PhabricatorAuditStatusConstants::getStatusIcon($status_code); - } else { - $reasons = null; - $status_text = null; - $status_color = null; - $status_icon = null; - } + $status = $commit->getAuditStatus(); + + $status_text = + PhabricatorAuditCommitStatusConstants::getStatusName($status); + $status_color = + PhabricatorAuditCommitStatusConstants::getStatusColor($status); + $status_icon = + PhabricatorAuditCommitStatusConstants::getStatusIcon($status); + $author_phid = $commit->getAuthorPHID(); if ($author_phid) { $author_name = $viewer->renderHandle($author_phid); @@ -143,8 +124,7 @@ final class PhabricatorAuditListView extends AphrontView { } if ($status_color) { - $item->setStatusIcon( - $status_icon.' '.$status_color, $status_text); + $item->setStatusIcon($status_icon.' '.$status_color, $status_text); } $list->addItem($item);