@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

adding a warning upon 'creating' a new document on an existing page

Summary: don't remember what I changed except for add that intermediate dialog

Test Plan:
{F35155}

Ugly, ain't it?

you can edit instead, or admit that it was a mistake to take on Phriction's existing documents

Reviewers: epriestley, chad, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2686

Differential Revision: https://secure.phabricator.com/D5295

authored by

Anh Nhan Nguyen and committed by
epriestley
4b6c81a2 855e085c

+26 -3
+26 -3
src/applications/phriction/controller/PhrictionNewController.php
··· 12 12 $slug = PhabricatorSlug::normalize($request->getStr('slug')); 13 13 14 14 if ($request->isFormPost()) { 15 - $uri = '/phriction/edit/?slug='.$slug; 16 - return id(new AphrontRedirectResponse()) 17 - ->setURI($uri); 15 + $document = id(new PhrictionDocument())->loadOneWhere( 16 + 'slug = %s', 17 + $slug); 18 + $prompt = $request->getStr('prompt', 'no'); 19 + $document_exists = $document && $document->getStatus() == 20 + PhrictionDocumentStatus::STATUS_EXISTS; 21 + 22 + if ($document_exists && $prompt == 'no') { 23 + $dialog = new AphrontDialogView(); 24 + $dialog->setSubmitURI('/phriction/new/') 25 + ->setTitle(pht('Edit Existing Document?')) 26 + ->setUser($user) 27 + ->appendChild(pht( 28 + 'The document %s already exists. Do you want to edit it instead?', 29 + hsprintf('<tt>%s</tt>', $slug))) 30 + ->addHiddenInput('slug', $slug) 31 + ->addHiddenInput('prompt', 'yes') 32 + ->addCancelButton('/w/') 33 + ->addSubmitButton(pht('Edit Document')); 34 + 35 + return id(new AphrontDialogResponse())->setDialog($dialog); 36 + } else { 37 + $uri = '/phriction/edit/?slug='.$slug; 38 + return id(new AphrontRedirectResponse()) 39 + ->setURI($uri); 40 + } 18 41 } 19 42 20 43 if ($slug == '/') {