1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +01:00

Merge "Audit" more completely into "Diffusion"

Summary:
Fixes T6630. Long ago, "Audit", "Diffusion" and "Repositories" were three totally separate applications.

This separation isn't useful and the three rapidly became intertwined. Ideally, they would all be one application.

This doesn't take us quite that far, but Audit no longer has any controllers and has little actual behavior.

The "Audit" screen has always just been a SearchEngine view of commits with some filters on it, and this formalizes that and puts a link to it in Diffusion. (This view has other uses, too.)

Test Plan:
  - Accessed audit from home page.
  - Accessed audit/commits from Diffusion.
  - Could no longer uninstall Audit on its own.
  - Grepped for `/audit/` and `AuditApplication`.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T6630

Differential Revision: https://secure.phabricator.com/D17186
This commit is contained in:
epriestley 2017-01-11 15:09:57 -08:00
parent c05cb1ba6d
commit 11861265fe
15 changed files with 65 additions and 53 deletions

View file

@ -642,6 +642,7 @@ phutil_register_library_map(array(
'DiffusionCommitHintQuery' => 'applications/diffusion/query/DiffusionCommitHintQuery.php',
'DiffusionCommitHookEngine' => 'applications/diffusion/engine/DiffusionCommitHookEngine.php',
'DiffusionCommitHookRejectException' => 'applications/diffusion/exception/DiffusionCommitHookRejectException.php',
'DiffusionCommitListController' => 'applications/diffusion/controller/DiffusionCommitListController.php',
'DiffusionCommitMergeHeraldField' => 'applications/diffusion/herald/DiffusionCommitMergeHeraldField.php',
'DiffusionCommitMessageHeraldField' => 'applications/diffusion/herald/DiffusionCommitMessageHeraldField.php',
'DiffusionCommitPackageAuditHeraldField' => 'applications/diffusion/herald/DiffusionCommitPackageAuditHeraldField.php',
@ -1873,7 +1874,6 @@ phutil_register_library_map(array(
'PhabricatorAuditController' => 'applications/audit/controller/PhabricatorAuditController.php',
'PhabricatorAuditEditor' => 'applications/audit/editor/PhabricatorAuditEditor.php',
'PhabricatorAuditInlineComment' => 'applications/audit/storage/PhabricatorAuditInlineComment.php',
'PhabricatorAuditListController' => 'applications/audit/controller/PhabricatorAuditListController.php',
'PhabricatorAuditListView' => 'applications/audit/view/PhabricatorAuditListView.php',
'PhabricatorAuditMailReceiver' => 'applications/audit/mail/PhabricatorAuditMailReceiver.php',
'PhabricatorAuditManagementDeleteWorkflow' => 'applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php',
@ -5346,6 +5346,7 @@ phutil_register_library_map(array(
'DiffusionCommitHintQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DiffusionCommitHookEngine' => 'Phobject',
'DiffusionCommitHookRejectException' => 'Exception',
'DiffusionCommitListController' => 'DiffusionController',
'DiffusionCommitMergeHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitMessageHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitPackageAuditHeraldField' => 'DiffusionCommitHeraldField',
@ -6764,7 +6765,6 @@ phutil_register_library_map(array(
'Phobject',
'PhabricatorInlineCommentInterface',
),
'PhabricatorAuditListController' => 'PhabricatorAuditController',
'PhabricatorAuditListView' => 'AphrontView',
'PhabricatorAuditMailReceiver' => 'PhabricatorObjectMailReceiver',
'PhabricatorAuditManagementDeleteWorkflow' => 'PhabricatorAuditManagementWorkflow',

View file

@ -3,7 +3,7 @@
final class PhabricatorAuditApplication extends PhabricatorApplication {
public function getBaseURI() {
return '/audit/';
return '/diffusion/commit/';
}
public function getIcon() {
@ -18,25 +18,16 @@ final class PhabricatorAuditApplication extends PhabricatorApplication {
return pht('Browse and Audit Commits');
}
public function canUninstall() {
// Audit was once a separate application, but has largely merged with
// Diffusion.
return false;
}
public function isPinnedByDefault(PhabricatorUser $viewer) {
return true;
}
public function getHelpDocumentationArticles(PhabricatorUser $viewer) {
return array(
array(
'name' => pht('Audit User Guide'),
'href' => PhabricatorEnv::getDoclink('Audit User Guide'),
),
);
}
public function getRoutes() {
return array(
'/audit/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorAuditListController',
),
);
return parent::isClassInstalledForViewer(
'PhabricatorDiffusionApplication',
$viewer);
}
public function getApplicationOrder() {

View file

@ -3,7 +3,8 @@
abstract class AuditConduitAPIMethod extends ConduitAPIMethod {
final public function getApplication() {
return PhabricatorApplication::getByClass('PhabricatorAuditApplication');
return PhabricatorApplication::getByClass(
'PhabricatorDiffusionApplication');
}
}

View file

@ -1,19 +0,0 @@
<?php
final class PhabricatorAuditListController
extends PhabricatorAuditController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($request->getURIData('queryKey'))
->setSearchEngine(new PhabricatorCommitSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
}
}

View file

@ -42,7 +42,7 @@ final class PhabricatorAuditEditor
}
public function getEditorApplicationClass() {
return 'PhabricatorAuditApplication';
return 'PhabricatorDiffusionApplication';
}
public function getEditorObjectsDescription() {

View file

@ -4,7 +4,7 @@ final class PhabricatorAuditMailReceiver extends PhabricatorObjectMailReceiver {
public function isEnabled() {
return PhabricatorApplication::isClassInstalled(
'PhabricatorAuditApplication');
'PhabricatorDiffusionApplication');
}
protected function getObjectPattern() {

View file

@ -73,7 +73,7 @@ final class PhabricatorCommitSearchEngine
}
protected function getURI($path) {
return '/audit/'.$path;
return '/diffusion/commit/'.$path;
}
protected function getBuiltinQueryNames() {

View file

@ -28,6 +28,10 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
'name' => pht('Diffusion User Guide'),
'href' => PhabricatorEnv::getDoclink('Diffusion User Guide'),
),
array(
'name' => pht('Audit User Guide'),
'href' => PhabricatorEnv::getDoclink('Audit User Guide'),
),
);
}
@ -131,6 +135,8 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
'lint/' => 'DiffusionLintController',
'commit/' => array(
$this->getQueryRoutePattern() =>
'DiffusionCommitListController',
$this->getEditRoutePattern('edit/') =>
'DiffusionCommitEditController',
),

View file

@ -0,0 +1,26 @@
<?php
final class DiffusionCommitListController
extends DiffusionController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
return id(new PhabricatorCommitSearchEngine())
->setController($this)
->buildResponse();
}
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb(
pht('Commits'),
$this->getApplicationURI('commit/'));
return $crumbs;
}
}

View file

@ -7,8 +7,19 @@ final class DiffusionRepositoryListController extends DiffusionController {
}
public function handleRequest(AphrontRequest $request) {
$items = array();
$items[] = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LABEL)
->setName(pht('Commits'));
$items[] = id(new PHUIListItemView())
->setName('Browse Commits')
->setHref($this->getApplicationURI('commit/'));
return id(new PhabricatorRepositorySearchEngine())
->setController($this)
->setNavigationItems($items)
->buildResponse();
}

View file

@ -65,7 +65,7 @@ final class PhabricatorOwnersDetailController
$commit_views = array();
$commit_uri = id(new PhutilURI('/audit/'))
$commit_uri = id(new PhutilURI('/diffusion/commit/'))
->setQueryParams(
array(
'auditorPHIDs' => $package->getPHID(),

View file

@ -63,7 +63,7 @@ final class PhabricatorPeopleProfileMenuEngine
$viewer);
if ($have_diffusion) {
$uri = urisprintf(
'/audit/?authors=%s#R',
'/diffusion/commit/?authors=%s#R',
$object->getPHID());
$items[] = $this->newItem()

View file

@ -6,7 +6,7 @@ final class PhabricatorJumpNavHandler extends Phobject {
$jump = trim($jump);
$patterns = array(
'/^a$/i' => 'uri:/audit/',
'/^a$/i' => 'uri:/diffusion/commit/',
'/^f$/i' => 'uri:/feed/',
'/^d$/i' => 'uri:/differential/',
'/^r$/i' => 'uri:/diffusion/',

View file

@ -37,10 +37,6 @@
"name": "Arcanist Integration",
"include": "(^src/applications/arcanist/)"
},
"audit": {
"name": "Audit",
"include": "(^src/applications/audit/)"
},
"auth": {
"name": "Auth",
"include": "(^src/applications/auth/)"

View file

@ -23,8 +23,8 @@ track of two things:
- **Audit Requests** which ask a user (or some other entity) to audit a
commit. These can be triggered in a number of ways (see below).
In the Audit tool's home screen (at `/audit/`) and on the homepage you can see
commits and requests that require your action:
In the Audit tool's home screen and on the homepage you can see commits and
requests that require your action:
- **Required Audits** are open audit requests that require you, a project
you are a member of, or a package you own to audit a commit. An audit