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

Converted the pinned applications selector to a typeahead.

Summary: Fixes T11513. Previously the selector was just a giant dropdown which was just... just too much. Now there's a handy typeahead.

Test Plan:
Happy Path:
Go to `Settings -> Home Page -> Pin Application`, start typing in the form then select one of the options. Click on "Pin Application". The application should now be in the list.

Other paths:
- Type nothing into the box and submit, nothing should happen.
- Choose an application that is already pinned. The list should stay the same.
- Type nonsense into the box and submit, nothing should happen.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: chad, Korvin, epriestley, yelirekim

Maniphest Tasks: T11513

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

Josh Cox 067d12d7 90294713

+20 -6
+3 -1
src/applications/meta/typeahead/PhabricatorApplicationDatasource.php
··· 38 38 ->setDisplayType($application->getShortDescription()) 39 39 ->setImageuRI($application->getIconURI()) 40 40 ->setPriorityType('apps') 41 - ->setImageSprite('phabricator-search-icon '.$img); 41 + ->setImageSprite('phabricator-search-icon '.$img) 42 + ->setIcon($application->getIcon()) 43 + ->addAttribute($application->getShortDescription()); 42 44 } 43 45 44 46 return $this->filterResultsAgainstTokens($results);
+17 -5
src/applications/settings/panel/PhabricatorHomePreferencesSettingsPanel.php
··· 67 67 unset($options['PhabricatorApplicationsApplication']); 68 68 69 69 if ($request->isFormPost()) { 70 - $pin = $request->getStr('pin'); 70 + $pins = $request->getArr('pin'); 71 + $phid = head($pins); 72 + $app = id(new PhabricatorApplicationQuery()) 73 + ->setViewer($viewer) 74 + ->withPHIDs(array($phid)) 75 + ->executeOne(); 76 + if ($app) { 77 + $pin = get_class($app); 78 + } else { 79 + // This likely means the user submitted an empty form 80 + // which will cause nothing to happen. 81 + $pin = ''; 82 + } 71 83 if (isset($options[$pin]) && !in_array($pin, $pinned)) { 72 84 $pinned[] = $pin; 73 85 ··· 78 90 } 79 91 } 80 92 81 - $options_control = id(new AphrontFormSelectControl()) 93 + $options_control = id(new AphrontFormTokenizerControl()) 82 94 ->setName('pin') 83 95 ->setLabel(pht('Application')) 84 - ->setOptions($options) 85 - ->setDisabledOptions(array_keys($app_list)); 96 + ->setDatasource(new PhabricatorApplicationDatasource()) 97 + ->setLimit(1); 86 98 87 99 $form = id(new AphrontFormView()) 88 100 ->setViewer($viewer) 89 101 ->addHiddenInput('add', 'true') 90 102 ->appendRemarkupInstructions( 91 103 pht('Choose an application to pin to your home page.')) 92 - ->appendChild($options_control); 104 + ->appendControl($options_control); 93 105 94 106 return $this->newDialog() 95 107 ->setWidth(AphrontDialogView::WIDTH_FORM)