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

Diviner: improve links, book index, and atom view

Summary: Ref T988. Minor improvements to diviner: link stuff to a valid endpoint which actually works; fix group names on the book index; improve the topics index for atom views.

Test Plan: Clicked links in an article, viewed book index, viewed an article with long headers.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T988

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

+90 -9
+1 -1
src/__celerity_resource_map__.php
··· 3857 3857 ), 3858 3858 'phui-list-view-css' => 3859 3859 array( 3860 - 'uri' => '/res/09f24365/rsrc/css/phui/phui-list.css', 3860 + 'uri' => '/res/3235e888/rsrc/css/phui/phui-list.css', 3861 3861 'type' => 'css', 3862 3862 'requires' => 3863 3863 array(
+2
src/__phutil_library_map__.php
··· 526 526 'DivinerDefaultRenderer' => 'applications/diviner/renderer/DivinerDefaultRenderer.php', 527 527 'DivinerDiskCache' => 'applications/diviner/cache/DivinerDiskCache.php', 528 528 'DivinerFileAtomizer' => 'applications/diviner/atomizer/DivinerFileAtomizer.php', 529 + 'DivinerFindController' => 'applications/diviner/controller/DivinerFindController.php', 529 530 'DivinerGenerateWorkflow' => 'applications/diviner/workflow/DivinerGenerateWorkflow.php', 530 531 'DivinerLegacyController' => 'applications/diviner/controller/DivinerLegacyController.php', 531 532 'DivinerLiveAtom' => 'applications/diviner/storage/DivinerLiveAtom.php', ··· 2519 2520 'DivinerDAO' => 'PhabricatorLiskDAO', 2520 2521 'DivinerDefaultRenderer' => 'DivinerRenderer', 2521 2522 'DivinerFileAtomizer' => 'DivinerAtomizer', 2523 + 'DivinerFindController' => 'DivinerController', 2522 2524 'DivinerGenerateWorkflow' => 'DivinerWorkflow', 2523 2525 'DivinerLegacyController' => 'DivinerController', 2524 2526 'DivinerLiveAtom' => 'DivinerDAO',
+1
src/applications/diviner/application/PhabricatorApplicationDiviner.php
··· 23 23 '/diviner/' => array( 24 24 '' => 'DivinerLegacyController', 25 25 'query/((?<key>[^/]+)/)?' => 'DivinerAtomListController', 26 + 'find/' => 'DivinerFindController', 26 27 ), 27 28 '/docs/(?P<keyword>[^/]+)/' => 'DivinerJumpController', 28 29 '/book/(?P<book>[^/]+)/' => 'DivinerBookController',
+72
src/applications/diviner/controller/DivinerFindController.php
··· 1 + <?php 2 + 3 + final class DivinerFindController extends DivinerController { 4 + 5 + public function shouldAllowPublic() { 6 + return true; 7 + } 8 + 9 + public function processRequest() { 10 + $request = $this->getRequest(); 11 + $viewer = $request->getUser(); 12 + 13 + $book_name = $request->getStr('book'); 14 + 15 + $book = null; 16 + if ($book_name) { 17 + $book = id(new DivinerBookQuery()) 18 + ->setViewer($viewer) 19 + ->withNames(array($book_name)) 20 + ->executeOne(); 21 + if (!$book) { 22 + return new Aphront404Response(); 23 + } 24 + } 25 + 26 + $query = id(new DivinerAtomQuery()) 27 + ->setViewer($viewer) 28 + ->withNames( 29 + array( 30 + $request->getStr('name'), 31 + // TODO: This could probably be more smartly normalized in the DB, 32 + // but just fake it for now. 33 + phutil_utf8_strtolower($request->getStr('name')), 34 + )); 35 + 36 + if ($book) { 37 + $query->withBookPHIDs(array($book->getPHID())); 38 + } 39 + 40 + $context = $request->getStr('context'); 41 + if (strlen($context)) { 42 + $query->withContexts(array($context)); 43 + } 44 + 45 + $type = $request->getStr('type'); 46 + if (strlen($type)) { 47 + $query->withTypes(array($type)); 48 + } 49 + 50 + $atoms = $query->execute(); 51 + 52 + if (!$atoms) { 53 + return new Aphront404Response(); 54 + } 55 + 56 + if (count($atoms) == 1 && $request->getBool('jump')) { 57 + $atom_uri = head($atoms)->getURI(); 58 + return id(new AphrontRedirectResponse())->setURI($atom_uri); 59 + } 60 + 61 + $list = $this->renderAtomList($atoms); 62 + 63 + return $this->buildApplicationPage( 64 + $list, 65 + array( 66 + 'title' => 'derp', 67 + 'dust' => true, 68 + 'device' => true, 69 + )); 70 + } 71 + 72 + }
+10 -3
src/applications/diviner/markup/DivinerRemarkupRuleSymbol.php
··· 57 57 $ref['name'] = $name; 58 58 } 59 59 60 - $ref['title'] = $title; 60 + $ref['title'] = nonempty($title, $name); 61 61 62 62 foreach ($ref as $key => $value) { 63 63 if ($value === '') { ··· 86 86 87 87 foreach ($data as $token => $ref_dict) { 88 88 $ref = DivinerAtomRef::newFromDictionary($ref_dict); 89 - $title = nonempty($ref->getTitle(), $ref->getName()); 89 + $title = $ref->getTitle(); 90 90 91 91 $href = null; 92 92 if ($renderer) { ··· 104 104 // link to Diviner and let it sort things out. 105 105 106 106 $href = id(new PhutilURI('/diviner/find/')) 107 - ->setQueryParams($ref_dict + array('jump' => true)); 107 + ->setQueryParams( 108 + array( 109 + 'book' => $ref->getBook(), 110 + 'name' => $ref->getName(), 111 + 'type' => $ref->getType(), 112 + 'context' => $ref->getContext(), 113 + 'jump' => true, 114 + )); 108 115 } 109 116 110 117 if ($this->getEngine()->isTextMode()) {
+1 -1
src/applications/diviner/storage/DivinerLiveBook.php
··· 42 42 public function getGroupName($group) { 43 43 $groups = $this->getConfig('groups'); 44 44 $spec = idx($groups, $group, array()); 45 - return idx($spec, 'name', pht('Free Radicals')); 45 + return idx($spec, 'name', $group); 46 46 } 47 47 48 48 /* -( PhabricatorPolicyInterface )----------------------------------------- */
+1 -1
src/applications/diviner/storage/DivinerLiveSymbol.php
··· 160 160 161 161 162 162 public function shouldUseMarkupCache($field) { 163 - return true; 163 + return false; 164 164 } 165 165 166 166 }
+2 -3
webroot/rsrc/css/phui/phui-list.css
··· 58 58 59 59 .phui-list-sidenav .phui-list-item-href { 60 60 display: block; 61 - padding: 2px 16px; 61 + padding: 4px 16px; 62 62 clear: both; 63 - line-height: 20px; 64 63 color: #333333; 65 - white-space: nowrap; 64 + line-height: 18px; 66 65 } 67 66 68 67 .phui-list-sidenav .phui-list-item-has-icon .phui-list-item-href {