Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/remarkup/DiffusionCommitRemarkupRule.php
12241 views
1
<?php
2
3
final class DiffusionCommitRemarkupRule extends PhabricatorObjectRemarkupRule {
4
5
protected function getObjectNamePrefix() {
6
return '';
7
}
8
9
protected function getObjectNamePrefixBeginsWithWordCharacter() {
10
return true;
11
}
12
13
protected function getObjectIDPattern() {
14
return PhabricatorRepositoryCommitPHIDType::getCommitObjectNamePattern();
15
}
16
17
protected function getObjectNameText(
18
$object,
19
PhabricatorObjectHandle $handle,
20
$id) {
21
22
// If this commit is unreachable, return the handle name instead of the
23
// normal text because it may be able to tell the user that the commit
24
// was rewritten and where to find the new one.
25
26
// By default, we try to preserve what the user actually typed as
27
// faithfully as possible, but if they're referencing a deleted commit
28
// it's more valuable to try to pick up any rewrite. See T11522.
29
if ($object->isUnreachable()) {
30
return $handle->getName();
31
}
32
33
return parent::getObjectNameText($object, $handle, $id);
34
}
35
36
protected function loadObjects(array $ids) {
37
$viewer = $this->getEngine()->getConfig('viewer');
38
39
$query = id(new DiffusionCommitQuery())
40
->setViewer($viewer)
41
->withIdentifiers($ids);
42
43
$query->execute();
44
return $query->getIdentifierMap();
45
}
46
47
}
48
49