Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/differential/herald/DifferentialRevisionJIRAIssueURIsHeraldField.php
12256 views
1
<?php
2
3
final class DifferentialRevisionJIRAIssueURIsHeraldField
4
extends DifferentialRevisionHeraldField {
5
6
const FIELDCONST = 'differential.revision.jira.uris';
7
8
public function getHeraldFieldName() {
9
return pht('JIRA Issue URIs');
10
}
11
12
public function supportsObject($object) {
13
$provider = PhabricatorJIRAAuthProvider::getJIRAProvider();
14
if (!$provider) {
15
return false;
16
}
17
18
return parent::supportsObject($object);
19
}
20
21
public function getHeraldFieldValue($object) {
22
$adapter = $this->getAdapter();
23
$viewer = $adapter->getViewer();
24
25
$jira_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
26
$object->getPHID(),
27
PhabricatorJiraIssueHasObjectEdgeType::EDGECONST);
28
if (!$jira_phids) {
29
return array();
30
}
31
32
$xobjs = id(new DoorkeeperExternalObjectQuery())
33
->setViewer($viewer)
34
->withPHIDs($jira_phids)
35
->execute();
36
37
return mpull($xobjs, 'getObjectURI');
38
}
39
40
protected function getHeraldFieldStandardType() {
41
return self::STANDARD_TEXT_LIST;
42
}
43
44
}
45
46