Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F80554
D7527.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D7527.diff
View Options
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,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();
}
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
@@ -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();
}
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
@@ -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 == '/') {
diff --git a/src/applications/phriction/editor/PhrictionDocumentEditor.php b/src/applications/phriction/editor/PhrictionDocumentEditor.php
--- a/src/applications/phriction/editor/PhrictionDocumentEditor.php
+++ b/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
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/hj/ae/pzvgktjj6rveehmb
Default Alt Text
D7527.diff (4 KB)
Attached To
Mode
D7527: Phriction - make the check for project sub pages more fine-grained
Attached
Detach File
Event Timeline
Log In to Comment