Differential D20907 Diff 49851 src/applications/diffusion/controller/DiffusionIdentityViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionIdentityViewController.php
Show All 16 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$title = pht('Identity %d', $identity->getID()); | $title = pht('Identity %d', $identity->getID()); | ||||
$curtain = $this->buildCurtain($identity); | $curtain = $this->buildCurtain($identity); | ||||
$header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setHeader($identity->getIdentityShortName()) | ->setHeader($identity->getIdentityShortName()) | ||||
->setHeaderIcon('fa-globe') | ->setHeaderIcon('fa-globe'); | ||||
->setPolicyObject($identity); | |||||
$crumbs = $this->buildApplicationCrumbs(); | $crumbs = $this->buildApplicationCrumbs(); | ||||
$crumbs->addTextCrumb($identity->getID()); | $crumbs->addTextCrumb($identity->getObjectName()); | ||||
$crumbs->setBorder(true); | $crumbs->setBorder(true); | ||||
$timeline = $this->buildTransactionTimeline( | $timeline = $this->buildTransactionTimeline( | ||||
$identity, | $identity, | ||||
new PhabricatorRepositoryIdentityTransactionQuery()); | new PhabricatorRepositoryIdentityTransactionQuery()); | ||||
$timeline->setShouldTerminate(true); | $timeline->setShouldTerminate(true); | ||||
$properties = $this->buildPropertyList($identity); | $properties = $this->buildPropertyList($identity); | ||||
Show All 40 Lines | final class DiffusionIdentityViewController | ||||
} | } | ||||
private function buildPropertyList( | private function buildPropertyList( | ||||
PhabricatorRepositoryIdentity $identity) { | PhabricatorRepositoryIdentity $identity) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$properties = id(new PHUIPropertyListView()) | $properties = id(new PHUIPropertyListView()) | ||||
->setUser($viewer); | ->setViewer($viewer); | ||||
$properties->addProperty( | |||||
pht('Email Address'), | |||||
$identity->getEmailAddress()); | |||||
$effective_phid = $identity->getCurrentEffectiveUserPHID(); | $effective_phid = $identity->getCurrentEffectiveUserPHID(); | ||||
$automatic_phid = $identity->getAutomaticGuessedUserPHID(); | $automatic_phid = $identity->getAutomaticGuessedUserPHID(); | ||||
$manual_phid = $identity->getManuallySetUserPHID(); | $manual_phid = $identity->getManuallySetUserPHID(); | ||||
if ($effective_phid) { | if ($effective_phid) { | ||||
$tag = id(new PHUITagView()) | $tag = id(new PHUITagView()) | ||||
->setType(PHUITagView::TYPE_SHADE) | ->setType(PHUITagView::TYPE_SHADE) | ||||
Show All 9 Lines | private function buildPropertyList( | ||||
} | } | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Effective User'), | pht('Effective User'), | ||||
$this->buildPropertyValue($effective_phid)); | $this->buildPropertyValue($effective_phid)); | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Automatically Detected User'), | pht('Automatically Detected User'), | ||||
$this->buildPropertyValue($automatic_phid)); | $this->buildPropertyValue($automatic_phid)); | ||||
$properties->addProperty( | $properties->addProperty( | ||||
pht('Manually Set User'), | pht('Assigned To'), | ||||
$this->buildPropertyValue($manual_phid)); | $this->buildPropertyValue($manual_phid)); | ||||
$header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
->setHeader(array(pht('Identity Assignments'), $tag)); | ->setHeader(array(pht('Identity Assignments'), $tag)); | ||||
return id(new PHUIObjectBoxView()) | return id(new PHUIObjectBoxView()) | ||||
->setHeader($header) | ->setHeader($header) | ||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | ||||
->addPropertyList($properties); | ->addPropertyList($properties); | ||||
} | } | ||||
private function buildPropertyValue($value) { | private function buildPropertyValue($value) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
if ($value == DiffusionIdentityUnassignedDatasource::FUNCTION_TOKEN) { | if ($value == DiffusionIdentityUnassignedDatasource::FUNCTION_TOKEN) { | ||||
return phutil_tag('em', array(), pht('Explicitly Unassigned')); | return phutil_tag('em', array(), pht('Explicitly Unassigned')); | ||||
} else if (!$value) { | } else if (!$value) { | ||||
return null; | return phutil_tag('em', array(), pht('None')); | ||||
} else { | } else { | ||||
return $viewer->renderHandle($value); | return $viewer->renderHandle($value); | ||||
} | } | ||||
} | } | ||||
} | } |