@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.

Improve 404 behavior for new Diviner

Summary:
Ref T988. When the user clicks a link we haven't explicitly resolved before, we send them to the `/find/` endpoint, but currently just 404 if we can't find the relevant documentation.

Instead, display a more user-friendly error message, since we're probably going to have some of these. Also, make the page title much worse.

Test Plan: Hit a 404 via `/find/`, got a nicer page.

Reviewers: chad, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T988

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

+17 -5
+17 -5
src/applications/diviner/controller/DivinerFindController.php
··· 11 11 $viewer = $request->getUser(); 12 12 13 13 $book_name = $request->getStr('book'); 14 + $query_text = $request->getStr('name'); 14 15 15 16 $book = null; 16 17 if ($book_name) { ··· 44 45 45 46 $name_query->withNames( 46 47 array( 47 - $request->getStr('name'), 48 + $query_text, 48 49 // TODO: This could probably be more smartly normalized in the DB, 49 50 // but just fake it for now. 50 - phutil_utf8_strtolower($request->getStr('name')), 51 + phutil_utf8_strtolower($query_text), 51 52 )); 52 53 53 54 $atoms = $name_query->execute(); 54 55 55 56 if (!$atoms) { 56 57 $title_query = clone $query; 57 - $title_query->withTitles(array($request->getStr('name'))); 58 + $title_query->withTitles(array($query_text)); 58 59 $atoms = $title_query->execute(); 59 60 } 61 + 62 + $not_found_uri = $this->getApplicationURI(); 60 63 61 64 if (!$atoms) { 62 - return new Aphront404Response(); 65 + $dialog = id(new AphrontDialogView()) 66 + ->setUser($viewer) 67 + ->setTitle(pht('Documentation Not Found')) 68 + ->appendChild( 69 + pht( 70 + 'Unable to find the specified documentation. You may have '. 71 + 'followed a bad or outdated link.')) 72 + ->addCancelButton($not_found_uri, pht('Read More Documentation')); 73 + 74 + return id(new AphrontDialogResponse())->setDialog($dialog); 63 75 } 64 76 65 77 if (count($atoms) == 1 && $request->getBool('jump')) { ··· 72 84 return $this->buildApplicationPage( 73 85 $list, 74 86 array( 75 - 'title' => 'derp', 87 + 'title' => array(pht('Find'), pht('"%s"', $query_text)), 76 88 'device' => true, 77 89 )); 78 90 }