Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepositoryCommit.php
Show First 20 Lines • Show All 410 Lines • ▼ Show 20 Lines | final class PhabricatorRepositoryCommit | ||||
* @return string Short human-readable name for use inside a repository. | * @return string Short human-readable name for use inside a repository. | ||||
*/ | */ | ||||
public function getLocalName() { | public function getLocalName() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
$identifier = $this->getCommitIdentifier(); | $identifier = $this->getCommitIdentifier(); | ||||
return $repository->formatCommitName($identifier, $local = true); | return $repository->formatCommitName($identifier, $local = true); | ||||
} | } | ||||
public function renderAuthorLink($handles) { | |||||
$author_phid = $this->getAuthorPHID(); | |||||
if ($author_phid && isset($handles[$author_phid])) { | |||||
return $handles[$author_phid]->renderLink(); | |||||
} | |||||
return $this->renderAuthorShortName($handles); | |||||
} | |||||
public function renderAuthorShortName($handles) { | |||||
$author_phid = $this->getAuthorPHID(); | |||||
if ($author_phid && isset($handles[$author_phid])) { | |||||
return $handles[$author_phid]->getName(); | |||||
} | |||||
$data = $this->getCommitData(); | |||||
$name = $data->getAuthorName(); | |||||
$parsed = new PhutilEmailAddress($name); | |||||
return nonempty($parsed->getDisplayName(), $parsed->getAddress()); | |||||
} | |||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */ | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 318 Lines • Show Last 20 Lines |