Differential D7946 Diff 18003 src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php
- This file was added.
<?php | |||||
final class ReleephDependsOnFieldSpecification | |||||
extends ReleephFieldSpecification { | |||||
public function getFieldKey() { | |||||
return 'dependsOn'; | |||||
} | |||||
public function getName() { | |||||
return pht('Depends On'); | |||||
} | |||||
epriestley: This should be wrapped in `pht()` (which is like `fbt()`) so it can be translated. | |||||
public function renderValueForHeaderView() { | |||||
$revision_phids = $this->getDependentRevisionPHIDs(); | |||||
if (!$revision_phids) { | |||||
return null; | |||||
} | |||||
$links = array(); | |||||
$handles = id(new PhabricatorHandleQuery()) | |||||
->setViewer($this->getUser()) | |||||
Not Done Inline ActionsIs there any guarantee this actually loads the dependent revisions' handles? I don't see where in the code we can be sure about this. epriestley: Is there any guarantee this actually loads the dependent revisions' handles? I don't see where… | |||||
->withPHIDs($revision_phids) | |||||
->execute(); | |||||
foreach ($revision_phids as $revision_phid) { | |||||
Not Done Inline ActionsConsider using clone on the object before making hacky mutations like this. That will prevent this from propagating to other sites which might use the same handle. epriestley: Consider using `clone` on the object before making hacky mutations like this. That will prevent… | |||||
$links[] = id(clone $handles[$revision_phid]) | |||||
// Hack to remove the strike-through rendering of diff links | |||||
Not Done Inline ActionsIn Zend PHP 5.5, this is a syntax error. It can be resolved by using id(). I don't know offhand if this is specific to HHVM or not, but we support old versions of PHP in the upstream. I'll just fix this in the pull. epriestley: In Zend PHP 5.5, this is a syntax error. It can be resolved by using `id()`. I don't know… | |||||
->setStatus(null) | |||||
->renderLink(); | |||||
} | |||||
return phutil_implode_html(phutil_tag('br'), $links); | |||||
} | |||||
private function getDependentRevisionPHIDs() { | |||||
$revision = $this | |||||
->getReleephRequest() | |||||
->loadDifferentialRevision(); | |||||
if (!$revision) { | |||||
return null; | |||||
} | |||||
return PhabricatorEdgeQuery::loadDestinationPHIDs( | |||||
$revision->getPHID(), | |||||
PhabricatorEdgeConfig::TYPE_DREV_DEPENDS_ON_DREV); | |||||
} | |||||
} |
This should be wrapped in pht() (which is like fbt()) so it can be translated.