Page MenuHomePhabricator

D7527.id16976.diff
No OneTemporary

D7527.id16976.diff

Index: src/applications/phriction/controller/PhrictionDocumentController.php
===================================================================
--- src/applications/phriction/controller/PhrictionDocumentController.php
+++ src/applications/phriction/controller/PhrictionDocumentController.php
@@ -40,9 +40,11 @@
$document = new PhrictionDocument();
if (PhrictionDocument::isProjectSlug($slug)) {
- $project = id(new PhabricatorProject())->loadOneWhere(
- 'phrictionSlug = %s',
- PhrictionDocument::getProjectSlugIdentifier($slug));
+ $project = id(new PhabricatorProjectQuery())
+ ->setViewer($user)
+ ->withPhrictionSlugs(array(
+ PhrictionDocument::getProjectSlugIdentifier($slug)))
+ ->executeOne();
if (!$project) {
return new Aphront404Response();
}
@@ -214,9 +216,11 @@
$project_phid = null;
if (PhrictionDocument::isProjectSlug($slug)) {
- $project = id(new PhabricatorProject())->loadOneWhere(
- 'phrictionSlug = %s',
- PhrictionDocument::getProjectSlugIdentifier($slug));
+ $project = id(new PhabricatorProjectQuery())
+ ->setViewer($viewer)
+ ->withPhrictionSlugs(array(
+ PhrictionDocument::getProjectSlugIdentifier($slug)))
+ ->executeOne();
if ($project) {
$project_phid = $project->getPHID();
}
Index: src/applications/phriction/controller/PhrictionEditController.php
===================================================================
--- src/applications/phriction/controller/PhrictionEditController.php
+++ src/applications/phriction/controller/PhrictionEditController.php
@@ -51,9 +51,11 @@
$content = id(new PhrictionContent())->load($document->getContentID());
} else {
if (PhrictionDocument::isProjectSlug($slug)) {
- $project = id(new PhabricatorProject())->loadOneWhere(
- 'phrictionSlug = %s',
- PhrictionDocument::getProjectSlugIdentifier($slug));
+ $project = id(new PhabricatorProjectQuery())
+ ->setViewer($user)
+ ->withPhrictionSlugs(array(
+ PhrictionDocument::getProjectSlugIdentifier($slug)))
+ ->executeOne();
if (!$project) {
return new Aphront404Response();
}
Index: src/applications/phriction/controller/PhrictionNewController.php
===================================================================
--- src/applications/phriction/controller/PhrictionNewController.php
+++ src/applications/phriction/controller/PhrictionNewController.php
@@ -33,7 +33,13 @@
->addSubmitButton(pht('Edit Document'));
return id(new AphrontDialogResponse())->setDialog($dialog);
- } elseif (substr($slug, 0, 9) == 'projects/') {
+ } 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!'))
@@ -44,12 +50,12 @@
Create a new project with this name first.'))
->addCancelButton('/w/', 'Okay');
return id(new AphrontDialogResponse())->setDialog($dialog);
-
- } else {
- $uri = '/phriction/edit/?slug='.$slug;
- return id(new AphrontRedirectResponse())
- ->setURI($uri);
+ }
}
+
+ $uri = '/phriction/edit/?slug='.$slug;
+ return id(new AphrontRedirectResponse())
+ ->setURI($uri);
}
if ($slug == '/') {
Index: src/applications/phriction/editor/PhrictionDocumentEditor.php
===================================================================
--- src/applications/phriction/editor/PhrictionDocumentEditor.php
+++ src/applications/phriction/editor/PhrictionDocumentEditor.php
@@ -240,9 +240,11 @@
$project_phid = null;
$slug = $document->getSlug();
if (PhrictionDocument::isProjectSlug($slug)) {
- $project = id(new PhabricatorProject())->loadOneWhere(
- 'phrictionSlug = %s',
- PhrictionDocument::getProjectSlugIdentifier($slug));
+ $project = id(new PhabricatorProjectQuery())
+ ->setViewer($this->requireActor())
+ ->withPhrictionSlugs(array(
+ PhrictionDocument::getProjectSlugIdentifier($slug)))
+ ->executeOne();
if ($project) {
$project_phid = $project->getPHID();
}

File Metadata

Mime Type
text/plain
Expires
Tue, Jan 28, 1:18 AM (10 h, 19 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7062526
Default Alt Text
D7527.id16976.diff (4 KB)

Event Timeline