mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 10:42:41 +01:00
Phriction - kill off rest of project integration
Summary: we don't need this stuff no mo'. Fixes T6506. Test Plan: cruised the wiki, noting workingess Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6506 Differential Revision: https://secure.phabricator.com/D10832
This commit is contained in:
parent
9252d2a579
commit
b462a80cca
6 changed files with 1 additions and 136 deletions
|
@ -2777,7 +2777,6 @@ phutil_register_library_map(array(
|
|||
'PhrictionDocumentPreviewController' => 'applications/phriction/controller/PhrictionDocumentPreviewController.php',
|
||||
'PhrictionDocumentQuery' => 'applications/phriction/query/PhrictionDocumentQuery.php',
|
||||
'PhrictionDocumentStatus' => 'applications/phriction/constants/PhrictionDocumentStatus.php',
|
||||
'PhrictionDocumentTestCase' => 'applications/phriction/storage/__tests__/PhrictionDocumentTestCase.php',
|
||||
'PhrictionEditConduitAPIMethod' => 'applications/phriction/conduit/PhrictionEditConduitAPIMethod.php',
|
||||
'PhrictionEditController' => 'applications/phriction/controller/PhrictionEditController.php',
|
||||
'PhrictionHistoryConduitAPIMethod' => 'applications/phriction/conduit/PhrictionHistoryConduitAPIMethod.php',
|
||||
|
@ -5995,7 +5994,6 @@ phutil_register_library_map(array(
|
|||
'PhrictionDocumentPreviewController' => 'PhrictionController',
|
||||
'PhrictionDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhrictionDocumentStatus' => 'PhrictionConstants',
|
||||
'PhrictionDocumentTestCase' => 'PhabricatorTestCase',
|
||||
'PhrictionEditConduitAPIMethod' => 'PhrictionConduitAPIMethod',
|
||||
'PhrictionEditController' => 'PhrictionController',
|
||||
'PhrictionHistoryConduitAPIMethod' => 'PhrictionConduitAPIMethod',
|
||||
|
|
|
@ -40,17 +40,6 @@ final class PhrictionDocumentController
|
|||
|
||||
$document = new PhrictionDocument();
|
||||
|
||||
if (PhrictionDocument::isProjectSlug($slug)) {
|
||||
$project = id(new PhabricatorProjectQuery())
|
||||
->setViewer($user)
|
||||
->withPhrictionSlugs(array(
|
||||
PhrictionDocument::getProjectSlugIdentifier($slug),
|
||||
))
|
||||
->executeOne();
|
||||
if (!$project) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
}
|
||||
$create_uri = '/phriction/edit/?slug='.$slug;
|
||||
|
||||
$notice = new AphrontErrorView();
|
||||
|
@ -258,34 +247,10 @@ final class PhrictionDocumentController
|
|||
->setUser($viewer)
|
||||
->setObject($document);
|
||||
|
||||
$project_phid = null;
|
||||
if (PhrictionDocument::isProjectSlug($slug)) {
|
||||
$project = id(new PhabricatorProjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withPhrictionSlugs(array(
|
||||
PhrictionDocument::getProjectSlugIdentifier($slug),
|
||||
))
|
||||
->executeOne();
|
||||
if ($project) {
|
||||
$project_phid = $project->getPHID();
|
||||
}
|
||||
}
|
||||
|
||||
$phids = array_filter(
|
||||
array(
|
||||
$content->getAuthorPHID(),
|
||||
$project_phid,
|
||||
));
|
||||
$phids = array($content->getAuthorPHID());
|
||||
|
||||
$this->loadHandles($phids);
|
||||
|
||||
$project_info = null;
|
||||
if ($project_phid) {
|
||||
$view->addProperty(
|
||||
pht('Project Info'),
|
||||
$this->getHandle($project_phid)->renderLink());
|
||||
}
|
||||
|
||||
$view->addProperty(
|
||||
pht('Last Author'),
|
||||
$this->getHandle($content->getAuthorPHID())->renderLink());
|
||||
|
|
|
@ -62,17 +62,6 @@ final class PhrictionEditController
|
|||
$content = $document->getContent();
|
||||
$current_version = $content->getVersion();
|
||||
} else {
|
||||
if (PhrictionDocument::isProjectSlug($slug)) {
|
||||
$project = id(new PhabricatorProjectQuery())
|
||||
->setViewer($user)
|
||||
->withPhrictionSlugs(array(
|
||||
PhrictionDocument::getProjectSlugIdentifier($slug),
|
||||
))
|
||||
->executeOne();
|
||||
if (!$project) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
}
|
||||
$document = PhrictionDocument::initializeNewDocument($user, $slug);
|
||||
$content = $document->getContent();
|
||||
}
|
||||
|
|
|
@ -30,25 +30,6 @@ final class PhrictionNewController extends PhrictionController {
|
|||
->addSubmitButton(pht('Edit Document'));
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
} else if (PhrictionDocument::isProjectSlug($slug)) {
|
||||
$project = id(new PhabricatorProjectQuery())
|
||||
->setViewer($user)
|
||||
->withPhrictionSlugs(array(
|
||||
PhrictionDocument::getProjectSlugIdentifier($slug),
|
||||
))
|
||||
->executeOne();
|
||||
if (!$project) {
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog->setSubmitURI('/w/')
|
||||
->setTitle(pht('Oops!'))
|
||||
->setUser($user)
|
||||
->appendChild(pht(
|
||||
'You cannot create wiki pages under "projects/",
|
||||
because they are reserved as project pages.
|
||||
Create a new project with this name first.'))
|
||||
->addCancelButton('/w/', 'Okay');
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
}
|
||||
|
||||
$uri = '/phriction/edit/?slug='.$slug;
|
||||
|
|
|
@ -144,26 +144,6 @@ final class PhrictionDocument extends PhrictionDAO
|
|||
return $this;
|
||||
}
|
||||
|
||||
public static function isProjectSlug($slug) {
|
||||
$slug = PhabricatorSlug::normalize($slug);
|
||||
$prefix = 'projects/';
|
||||
if ($slug == $prefix) {
|
||||
// The 'projects/' document is not itself a project slug.
|
||||
return false;
|
||||
}
|
||||
return !strncmp($slug, $prefix, strlen($prefix));
|
||||
}
|
||||
|
||||
public static function getProjectSlugIdentifier($slug) {
|
||||
if (!self::isProjectSlug($slug)) {
|
||||
throw new Exception("Slug '{$slug}' is not a project slug!");
|
||||
}
|
||||
|
||||
$slug = PhabricatorSlug::normalize($slug);
|
||||
$parts = explode('/', $slug);
|
||||
return $parts[1].'/';
|
||||
}
|
||||
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class PhrictionDocumentTestCase extends PhabricatorTestCase {
|
||||
|
||||
public function testProjectSlugs() {
|
||||
$slugs = array(
|
||||
'/' => false,
|
||||
'zebra/' => false,
|
||||
'projects/' => false,
|
||||
'projects/a/' => true,
|
||||
'projects/a/b/' => true,
|
||||
'stuff/projects/a/' => false,
|
||||
);
|
||||
|
||||
foreach ($slugs as $slug => $expect) {
|
||||
$this->assertEqual(
|
||||
$expect,
|
||||
PhrictionDocument::isProjectSlug($slug),
|
||||
"Is '{$slug}' a project slug?");
|
||||
}
|
||||
}
|
||||
|
||||
public function testProjectSlugIdentifiers() {
|
||||
$slugs = array(
|
||||
'projects/' => null,
|
||||
'derp/' => null,
|
||||
'projects/a/' => 'a/',
|
||||
'projects/a/b/' => 'a/',
|
||||
);
|
||||
|
||||
foreach ($slugs as $slug => $expect) {
|
||||
$ex = null;
|
||||
$result = null;
|
||||
try {
|
||||
$result = PhrictionDocument::getProjectSlugIdentifier($slug);
|
||||
} catch (Exception $e) {
|
||||
$ex = $e;
|
||||
}
|
||||
|
||||
if ($expect === null) {
|
||||
$this->assertTrue((bool)$ex, "Slug '{$slug}' is invalid.");
|
||||
} else {
|
||||
$this->assertEqual($expect, $result, "Slug '{$slug}' identifier.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue