1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

Alert user that projects/ is protected in Phriction

Summary: Fixes T3447 - adds check if slug is projects/ alerts user

Test Plan: Create new doc in Phriction. Type projects/whatever and get error

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Maniphest Tasks: T3447

Differential Revision: https://secure.phabricator.com/D6901
This commit is contained in:
Guy Warner 2013-09-06 10:42:02 -07:00 committed by epriestley
parent 95dc69a30e
commit 03783c4f63

View file

@ -33,6 +33,18 @@ final class PhrictionNewController extends PhrictionController {
->addSubmitButton(pht('Edit Document')); ->addSubmitButton(pht('Edit Document'));
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
} elseif (substr($slug, 0, 9) == 'projects/') {
$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);
} else { } else {
$uri = '/phriction/edit/?slug='.$slug; $uri = '/phriction/edit/?slug='.$slug;
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())