mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-24 21:48:21 +01:00
Add a Diffusion repository remarkup rule
Summary: Currently we markup `rXabcd`, but not `rX` on its own. Mark these up as repository object names. Test Plan: Typed `rPOEMS`, `rPOEMS1`, `rPOEMS139893189`, etc. Reviewers: btrahan, dctrwatson Reviewed By: btrahan CC: aran, poop Differential Revision: https://secure.phabricator.com/D7859
This commit is contained in:
parent
db89883447
commit
c20fd58303
5 changed files with 35 additions and 5 deletions
|
@ -483,6 +483,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionCommitHookRejectException' => 'applications/diffusion/exception/DiffusionCommitHookRejectException.php',
|
'DiffusionCommitHookRejectException' => 'applications/diffusion/exception/DiffusionCommitHookRejectException.php',
|
||||||
'DiffusionCommitQuery' => 'applications/diffusion/query/DiffusionCommitQuery.php',
|
'DiffusionCommitQuery' => 'applications/diffusion/query/DiffusionCommitQuery.php',
|
||||||
'DiffusionCommitRef' => 'applications/diffusion/data/DiffusionCommitRef.php',
|
'DiffusionCommitRef' => 'applications/diffusion/data/DiffusionCommitRef.php',
|
||||||
|
'DiffusionCommitRemarkupRule' => 'applications/diffusion/remarkup/DiffusionCommitRemarkupRule.php',
|
||||||
'DiffusionCommitTagsController' => 'applications/diffusion/controller/DiffusionCommitTagsController.php',
|
'DiffusionCommitTagsController' => 'applications/diffusion/controller/DiffusionCommitTagsController.php',
|
||||||
'DiffusionController' => 'applications/diffusion/controller/DiffusionController.php',
|
'DiffusionController' => 'applications/diffusion/controller/DiffusionController.php',
|
||||||
'DiffusionDiffController' => 'applications/diffusion/controller/DiffusionDiffController.php',
|
'DiffusionDiffController' => 'applications/diffusion/controller/DiffusionDiffController.php',
|
||||||
|
@ -530,7 +531,6 @@ phutil_register_library_map(array(
|
||||||
'DiffusionPushLogListController' => 'applications/diffusion/controller/DiffusionPushLogListController.php',
|
'DiffusionPushLogListController' => 'applications/diffusion/controller/DiffusionPushLogListController.php',
|
||||||
'DiffusionQuery' => 'applications/diffusion/query/DiffusionQuery.php',
|
'DiffusionQuery' => 'applications/diffusion/query/DiffusionQuery.php',
|
||||||
'DiffusionRawDiffQuery' => 'applications/diffusion/query/rawdiff/DiffusionRawDiffQuery.php',
|
'DiffusionRawDiffQuery' => 'applications/diffusion/query/rawdiff/DiffusionRawDiffQuery.php',
|
||||||
'DiffusionRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRemarkupRule.php',
|
|
||||||
'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php',
|
'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php',
|
||||||
'DiffusionRepositoryController' => 'applications/diffusion/controller/DiffusionRepositoryController.php',
|
'DiffusionRepositoryController' => 'applications/diffusion/controller/DiffusionRepositoryController.php',
|
||||||
'DiffusionRepositoryCreateController' => 'applications/diffusion/controller/DiffusionRepositoryCreateController.php',
|
'DiffusionRepositoryCreateController' => 'applications/diffusion/controller/DiffusionRepositoryCreateController.php',
|
||||||
|
@ -551,6 +551,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryNewController' => 'applications/diffusion/controller/DiffusionRepositoryNewController.php',
|
'DiffusionRepositoryNewController' => 'applications/diffusion/controller/DiffusionRepositoryNewController.php',
|
||||||
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
|
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
|
||||||
'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php',
|
'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php',
|
||||||
|
'DiffusionRepositoryRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryRemarkupRule.php',
|
||||||
'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php',
|
'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php',
|
||||||
'DiffusionRequest' => 'applications/diffusion/request/DiffusionRequest.php',
|
'DiffusionRequest' => 'applications/diffusion/request/DiffusionRequest.php',
|
||||||
'DiffusionResolveUserQuery' => 'applications/diffusion/query/DiffusionResolveUserQuery.php',
|
'DiffusionResolveUserQuery' => 'applications/diffusion/query/DiffusionResolveUserQuery.php',
|
||||||
|
@ -2886,6 +2887,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionCommitHookRejectException' => 'Exception',
|
'DiffusionCommitHookRejectException' => 'Exception',
|
||||||
'DiffusionCommitQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'DiffusionCommitQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'DiffusionCommitRef' => 'Phobject',
|
'DiffusionCommitRef' => 'Phobject',
|
||||||
|
'DiffusionCommitRemarkupRule' => 'PhabricatorRemarkupRuleObject',
|
||||||
'DiffusionCommitTagsController' => 'DiffusionController',
|
'DiffusionCommitTagsController' => 'DiffusionController',
|
||||||
'DiffusionController' => 'PhabricatorController',
|
'DiffusionController' => 'PhabricatorController',
|
||||||
'DiffusionDiffController' => 'DiffusionController',
|
'DiffusionDiffController' => 'DiffusionController',
|
||||||
|
@ -2929,7 +2931,6 @@ phutil_register_library_map(array(
|
||||||
),
|
),
|
||||||
'DiffusionQuery' => 'PhabricatorQuery',
|
'DiffusionQuery' => 'PhabricatorQuery',
|
||||||
'DiffusionRawDiffQuery' => 'DiffusionQuery',
|
'DiffusionRawDiffQuery' => 'DiffusionQuery',
|
||||||
'DiffusionRemarkupRule' => 'PhabricatorRemarkupRuleObject',
|
|
||||||
'DiffusionRepositoryController' => 'DiffusionController',
|
'DiffusionRepositoryController' => 'DiffusionController',
|
||||||
'DiffusionRepositoryCreateController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryCreateController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryDefaultController' => 'DiffusionController',
|
'DiffusionRepositoryDefaultController' => 'DiffusionController',
|
||||||
|
@ -2951,6 +2952,7 @@ phutil_register_library_map(array(
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
||||||
),
|
),
|
||||||
'DiffusionRepositoryNewController' => 'DiffusionController',
|
'DiffusionRepositoryNewController' => 'DiffusionController',
|
||||||
|
'DiffusionRepositoryRemarkupRule' => 'PhabricatorRemarkupRuleObject',
|
||||||
'DiffusionResolveUserQuery' => 'Phobject',
|
'DiffusionResolveUserQuery' => 'Phobject',
|
||||||
'DiffusionSSHGitReceivePackWorkflow' => 'DiffusionSSHGitWorkflow',
|
'DiffusionSSHGitReceivePackWorkflow' => 'DiffusionSSHGitWorkflow',
|
||||||
'DiffusionSSHGitUploadPackWorkflow' => 'DiffusionSSHGitWorkflow',
|
'DiffusionSSHGitUploadPackWorkflow' => 'DiffusionSSHGitWorkflow',
|
||||||
|
|
|
@ -32,7 +32,8 @@ final class PhabricatorApplicationDiffusion extends PhabricatorApplication {
|
||||||
|
|
||||||
public function getRemarkupRules() {
|
public function getRemarkupRules() {
|
||||||
return array(
|
return array(
|
||||||
new DiffusionRemarkupRule(),
|
new DiffusionRepositoryRemarkupRule(),
|
||||||
|
new DiffusionCommitRemarkupRule(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,11 +76,13 @@ final class DiffusionCommitQuery
|
||||||
return $this->identifierMap;
|
return $this->identifierMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadPage() {
|
protected function willExecute() {
|
||||||
if ($this->identifierMap === null) {
|
if ($this->identifierMap === null) {
|
||||||
$this->identifierMap = array();
|
$this->identifierMap = array();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function loadPage() {
|
||||||
$table = new PhabricatorRepositoryCommit();
|
$table = new PhabricatorRepositoryCommit();
|
||||||
$conn_r = $table->establishConnection('r');
|
$conn_r = $table->establishConnection('r');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DiffusionRemarkupRule
|
final class DiffusionCommitRemarkupRule
|
||||||
extends PhabricatorRemarkupRuleObject {
|
extends PhabricatorRemarkupRuleObject {
|
||||||
|
|
||||||
protected function getObjectNamePrefix() {
|
protected function getObjectNamePrefix() {
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionRepositoryRemarkupRule
|
||||||
|
extends PhabricatorRemarkupRuleObject {
|
||||||
|
|
||||||
|
protected function getObjectNamePrefix() {
|
||||||
|
return 'r';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getObjectIDPattern() {
|
||||||
|
return '[A-Z]+';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function loadObjects(array $ids) {
|
||||||
|
$viewer = $this->getEngine()->getConfig('viewer');
|
||||||
|
|
||||||
|
$repositories = id(new PhabricatorRepositoryQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withCallsigns($ids)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
return mpull($repositories, null, 'getCallsign');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue