Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/storage/PhabricatorRepositoryCommit.php
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | final class PhabricatorRepositoryCommit | ||||
} | } | ||||
public function getDisplayName() { | public function getDisplayName() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
$identifier = $this->getCommitIdentifier(); | $identifier = $this->getCommitIdentifier(); | ||||
return $repository->formatCommitName($identifier); | return $repository->formatCommitName($identifier); | ||||
} | } | ||||
public function getShortName() { | |||||
$identifier = $this->getCommitIdentifier(); | |||||
return substr($identifier, 0, 9); | |||||
} | |||||
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 187 Lines • Show Last 20 Lines |