Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14810691
D7527.id16976.diff
No One
Temporary
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.id16976.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D7527: Phriction - make the check for project sub pages more fine-grained
Attached
Detach File
Event Timeline
Log In to Comment