Page MenuHomePhabricator

D10832.diff
No OneTemporary

D10832.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2777,7 +2777,6 @@
'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 @@
'PhrictionDocumentPreviewController' => 'PhrictionController',
'PhrictionDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhrictionDocumentStatus' => 'PhrictionConstants',
- 'PhrictionDocumentTestCase' => 'PhabricatorTestCase',
'PhrictionEditConduitAPIMethod' => 'PhrictionConduitAPIMethod',
'PhrictionEditController' => 'PhrictionController',
'PhrictionHistoryConduitAPIMethod' => 'PhrictionConduitAPIMethod',
diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php
--- a/src/applications/phriction/controller/PhrictionDocumentController.php
+++ b/src/applications/phriction/controller/PhrictionDocumentController.php
@@ -40,17 +40,6 @@
$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 @@
->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());
diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php
--- a/src/applications/phriction/controller/PhrictionEditController.php
+++ b/src/applications/phriction/controller/PhrictionEditController.php
@@ -62,17 +62,6 @@
$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();
}
diff --git a/src/applications/phriction/controller/PhrictionNewController.php b/src/applications/phriction/controller/PhrictionNewController.php
--- a/src/applications/phriction/controller/PhrictionNewController.php
+++ b/src/applications/phriction/controller/PhrictionNewController.php
@@ -30,25 +30,6 @@
->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;
diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php
--- a/src/applications/phriction/storage/PhrictionDocument.php
+++ b/src/applications/phriction/storage/PhrictionDocument.php
@@ -144,26 +144,6 @@
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 )----------------------------------------- */
diff --git a/src/applications/phriction/storage/__tests__/PhrictionDocumentTestCase.php b/src/applications/phriction/storage/__tests__/PhrictionDocumentTestCase.php
deleted file mode 100644
--- a/src/applications/phriction/storage/__tests__/PhrictionDocumentTestCase.php
+++ /dev/null
@@ -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.");
- }
- }
- }
-
-}

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 15, 2:58 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7371292
Default Alt Text
D10832.diff (7 KB)

Event Timeline