1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

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
This commit is contained in:
epriestley 2017-01-12 12:56:10 -08:00
parent 19525ed81a
commit e66a03eaa3
2 changed files with 11 additions and 35 deletions

View file

@ -139,12 +139,8 @@ final class PhabricatorCommitSearchEngine
$bucket = $this->getResultBucket($query); $bucket = $this->getResultBucket($query);
$authority_phids = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser(
$viewer);
$template = id(new PhabricatorAuditListView()) $template = id(new PhabricatorAuditListView())
->setViewer($viewer) ->setViewer($viewer);
->setAuthorityPHIDs($authority_phids);
$views = array(); $views = array();
if ($bucket) { if ($bucket) {

View file

@ -3,16 +3,10 @@
final class PhabricatorAuditListView extends AphrontView { final class PhabricatorAuditListView extends AphrontView {
private $commits; private $commits;
private $authorityPHIDs = array();
private $header; private $header;
private $noDataString; private $noDataString;
private $highlightedAudits; private $highlightedAudits;
public function setAuthorityPHIDs(array $phids) {
$this->authorityPHIDs = $phids;
return $this;
}
public function setNoDataString($no_data_string) { public function setNoDataString($no_data_string) {
$this->noDataString = $no_data_string; $this->noDataString = $no_data_string;
return $this; return $this;
@ -101,28 +95,15 @@ final class PhabricatorAuditListView extends AphrontView {
} }
$auditors = phutil_implode_html(', ', $auditors); $auditors = phutil_implode_html(', ', $auditors);
$authority_audits = array_select_keys($audits, $this->authorityPHIDs); $status = $commit->getAuditStatus();
if ($authority_audits) {
$audit = reset($authority_audits); $status_text =
} else { PhabricatorAuditCommitStatusConstants::getStatusName($status);
$audit = reset($audits); $status_color =
} PhabricatorAuditCommitStatusConstants::getStatusColor($status);
if ($audit) { $status_icon =
$reasons = $audit->getAuditReasons(); PhabricatorAuditCommitStatusConstants::getStatusIcon($status);
$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;
}
$author_phid = $commit->getAuthorPHID(); $author_phid = $commit->getAuthorPHID();
if ($author_phid) { if ($author_phid) {
$author_name = $viewer->renderHandle($author_phid); $author_name = $viewer->renderHandle($author_phid);
@ -143,8 +124,7 @@ final class PhabricatorAuditListView extends AphrontView {
} }
if ($status_color) { if ($status_color) {
$item->setStatusIcon( $item->setStatusIcon($status_icon.' '.$status_color, $status_text);
$status_icon.' '.$status_color, $status_text);
} }
$list->addItem($item); $list->addItem($item);