Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phriction/controller/PhrictionNewController.php
<?php | <?php | ||||
/** | |||||
* @group phriction | |||||
*/ | |||||
final class PhrictionNewController extends PhrictionController { | final class PhrictionNewController extends PhrictionController { | ||||
public function processRequest() { | public function processRequest() { | ||||
$request = $this->getRequest(); | $request = $this->getRequest(); | ||||
$user = $request->getUser(); | $user = $request->getUser(); | ||||
$slug = PhabricatorSlug::normalize($request->getStr('slug')); | $slug = PhabricatorSlug::normalize($request->getStr('slug')); | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$document = id(new PhrictionDocument())->loadOneWhere( | $document = id(new PhrictionDocumentQuery()) | ||||
'slug = %s', | ->setViewer($user) | ||||
$slug); | ->withSlugs(array($slug)) | ||||
->executeOne(); | |||||
$prompt = $request->getStr('prompt', 'no'); | $prompt = $request->getStr('prompt', 'no'); | ||||
$document_exists = $document && $document->getStatus() == | $document_exists = $document && $document->getStatus() == | ||||
PhrictionDocumentStatus::STATUS_EXISTS; | PhrictionDocumentStatus::STATUS_EXISTS; | ||||
if ($document_exists && $prompt == 'no') { | if ($document_exists && $prompt == 'no') { | ||||
$dialog = new AphrontDialogView(); | $dialog = new AphrontDialogView(); | ||||
$dialog->setSubmitURI('/phriction/new/') | $dialog->setSubmitURI('/phriction/new/') | ||||
->setTitle(pht('Edit Existing Document?')) | ->setTitle(pht('Edit Existing Document?')) | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |