From d403700e1fc6b3a5816393e5c2c9ceff1cf2f83c Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 31 Mar 2015 14:10:55 -0700 Subject: [PATCH] Convert all tokenizers to take token/scalar inputs Summary: Ref T7689. Ref T4100. This advances the goals of removing `loadViewerHandles()` (only 67 callsites remain!) and letting tokenizers some day take token functions like `viewer()` and `members(differential)`. Test Plan: - Sent a new message; used "To". - I simplified the cancel URI construction slightly because it's moot in all normal cases. - Edited a thread; used "Add Participants". - Searched rooms; used "Participants". - Searched countdowns; used "Authors". - Created a diff; used "Repository". - Edited a revision; edited "Projects"; edited "Reveiwers"; edited "Subscribers". - Searched for revisions; edited "responsible users"; "authors"; "reviwers"; "subscribers"; "repositories". - Added revision comments; edited "Add Reveiwers"; "Add Subscribers". - Commented on a commit; edited "Add Auditors"; "Add subscribers". - Edited a commit; edited "Projects". - Edited a repository; edited "Projects". - Searched feed, used "include Users"; "include Proejcts". - Searched files, used "authors". - Edited initiative; edited "Projects". - Searched backers; used "Backers". - Searched initiatives; used "Owners". - Edited build plans; edited "Run Command". - Searched Herald; used "Authors". - Added signature exemption in Legalpad. - Searhced legalpad; used "creators"; used "contributors". - Searched signatures; used "documents"; used "signers". - Created meme. - Searched macros; used "Authors". - Used "Projects" in Maniphest reports. - Used Maniphest comment actions. - Edited Maniphest tasks; edited "Assigned To"; edited "CC"; edited "projects". - Used "parent" in Maniphest task creation workflow. - Searched for projects; used "assigned to"; "in any projec"; "in all projects"; "not in projects"; "in users' projects"; "authors"; "subscribers". - Edited Maniphest bug filing domains, used "Default Author". - Searched for OAuth applications, used "Creators". - Edited Owners pacakge; edited "Primary Owner"; edited "Owners". - Searched for Owners packages; used "Owner". - OMG this UI is OLD - Edited a paste; edited "Projects". - Searched for paste; used "Authors". - Searched user activity log; used "Actors"; used "Users". - Edited a mock; edited "Projects"; edited "CC". - Searched for mocks; used "Authors". - Edited Phortune account; edited "Members". - Edited Phortune merchant account; edited "Members". - Searched Phrequent; used "Users". - Edited Ponder question; sued "projects". - Searched Ponder; used "Authors"; used "Answered By". - Added project members. - Searched for projects; used "Members". - Edited a Releeph product; edited "Pushers". - Searched pull requests; searched "Requestors". - Edited an arcanist project; used "Uses Symbols From". - Searhced push logs; used "Repositories"; used "Pushers". - Searched repositories; used "In nay project". - Used global search; used Authors/owners/Subscribers/In Any Project. - Edited a slowvote; used "Projects". - Searched slovotes; used "Authors". - Created a custom "Users" field; edited and searched for it. - Made a whole lot of typos in this list. ^^^^^^ Did not test: - Lint is nontrivial to test locally, I'll test it in production. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4100, T7689 Differential Revision: https://secure.phabricator.com/D12224 --- resources/celerity/map.php | 42 ++++++------- .../controller/ConpherenceNewController.php | 34 +++------- .../ConpherenceUpdateController.php | 12 ++-- .../query/ConpherenceThreadSearchEngine.php | 17 +++-- .../PhabricatorCountdownSearchEngine.php | 10 +-- .../DifferentialDiffCreateController.php | 36 ++++++----- .../customfield/DifferentialProjectsField.php | 7 +-- .../DifferentialRepositoryField.php | 15 ++--- .../DifferentialReviewersField.php | 8 +-- .../DifferentialSubscribersField.php | 7 +-- .../DifferentialRevisionSearchEngine.php | 34 +++------- .../view/DifferentialAddCommentView.php | 4 +- .../controller/DiffusionCommitController.php | 4 +- .../DiffusionCommitEditController.php | 12 ++-- .../controller/DiffusionLintController.php | 5 +- ...DiffusionRepositoryEditBasicController.php | 5 +- .../query/PhabricatorFeedSearchEngine.php | 17 ++--- .../query/PhabricatorFileSearchEngine.php | 11 +--- .../FundInitiativeEditController.php | 10 +-- .../fund/query/FundBackerSearchEngine.php | 15 +---- .../fund/query/FundInitiativeSearchEngine.php | 14 +---- .../HarbormasterStepEditController.php | 9 +-- .../herald/query/HeraldRuleSearchEngine.php | 11 +--- ...LegalpadDocumentSignatureAddController.php | 5 +- .../query/LegalpadDocumentSearchEngine.php | 13 ++-- .../LegalpadDocumentSignatureSearchEngine.php | 14 ++--- .../PhabricatorMacroMemeDialogController.php | 9 +-- .../query/PhabricatorMacroSearchEngine.php | 11 +--- .../controller/ManiphestReportController.php | 5 +- .../ManiphestTaskDetailController.php | 6 +- .../ManiphestTaskEditController.php | 28 +++------ .../query/ManiphestTaskSearchEngine.php | 63 ++++++------------- ...habricatorMetaMTAApplicationEmailPanel.php | 16 +++-- ...abricatorOAuthServerClientSearchEngine.php | 10 +-- .../PhabricatorOwnersEditController.php | 18 +++--- .../PhabricatorOwnersListController.php | 12 +--- .../PhabricatorPasteEditController.php | 10 +-- .../query/PhabricatorPasteSearchEngine.php | 10 +-- .../PhabricatorPeopleLogSearchEngine.php | 24 ++----- .../controller/PholioMockEditController.php | 19 ++---- .../pholio/query/PholioMockSearchEngine.php | 10 +-- .../PhortuneAccountEditController.php | 6 +- .../PhortuneMerchantEditController.php | 6 +- .../phrequent/query/PhrequentSearchEngine.php | 10 +-- .../PonderQuestionEditController.php | 10 +-- .../query/PonderQuestionSearchEngine.php | 14 ++--- ...habricatorProjectBoardImportController.php | 1 + ...habricatorProjectMembersEditController.php | 2 +- .../query/PhabricatorProjectSearchEngine.php | 10 +-- .../product/ReleephProductEditController.php | 11 +--- .../query/ReleephRequestSearchEngine.php | 10 +-- ...epositoryArcanistProjectEditController.php | 7 +-- ...abricatorRepositoryPushLogSearchEngine.php | 24 ++----- .../PhabricatorRepositorySearchEngine.php | 13 +--- ...abricatorSearchApplicationSearchEngine.php | 32 +++------- .../PhabricatorSlowvoteEditController.php | 10 +-- .../query/PhabricatorSlowvoteSearchEngine.php | 10 +-- .../PhabricatorStandardCustomFieldUsers.php | 12 ++-- src/view/form/AphrontFormView.php | 11 ++++ 59 files changed, 261 insertions(+), 560 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index d5c3eafeed..43366591b1 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -7,7 +7,7 @@ */ return array( 'names' => array( - 'core.pkg.css' => '20d3b672', + 'core.pkg.css' => 'ad650d52', 'core.pkg.js' => '0c88e7f6', 'darkconsole.pkg.js' => '8ab24e01', 'differential.pkg.css' => '3500921f', @@ -20,7 +20,7 @@ return array( 'rsrc/css/aphront/dark-console.css' => '6378ef3d', 'rsrc/css/aphront/dialog-view.css' => 'd2e76b88', 'rsrc/css/aphront/lightbox-attachment.css' => '7acac05d', - 'rsrc/css/aphront/list-filter-view.css' => '2ae43867', + 'rsrc/css/aphront/list-filter-view.css' => '18b7e144', 'rsrc/css/aphront/multi-column.css' => 'fd18389d', 'rsrc/css/aphront/notification.css' => '9c279160', 'rsrc/css/aphront/pager-view.css' => '2e3539af', @@ -34,7 +34,7 @@ return array( 'rsrc/css/aphront/typeahead.css' => '0e403212', 'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af', 'rsrc/css/application/auth/auth.css' => '1e655982', - 'rsrc/css/application/base/main-menu-view.css' => 'cfa2ec0f', + 'rsrc/css/application/base/main-menu-view.css' => '361a51f9', 'rsrc/css/application/base/notification-menu.css' => '6aa0a74b', 'rsrc/css/application/base/phabricator-application-launch-view.css' => '16ca323f', 'rsrc/css/application/base/standard-page-view.css' => 'd2a6518d', @@ -45,7 +45,7 @@ return array( 'rsrc/css/application/config/setup-issue.css' => '22270af2', 'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2', 'rsrc/css/application/conpherence/durable-column.css' => 'caa12d4a', - 'rsrc/css/application/conpherence/menu.css' => 'beef0920', + 'rsrc/css/application/conpherence/menu.css' => '7c900089', 'rsrc/css/application/conpherence/message-pane.css' => '44154798', 'rsrc/css/application/conpherence/notification.css' => '04a6e10a', 'rsrc/css/application/conpherence/update.css' => '1099a660', @@ -355,7 +355,7 @@ return array( 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'bb928342', 'rsrc/js/application/conpherence/behavior-durable-column.js' => 'a0216452', - 'rsrc/js/application/conpherence/behavior-menu.js' => 'de5579b4', + 'rsrc/js/application/conpherence/behavior-menu.js' => 'cda6de80', 'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861', 'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3', 'rsrc/js/application/conpherence/behavior-widget-pane.js' => '1ec93bcf', @@ -501,7 +501,7 @@ return array( 'aphront-bars' => '231ac33c', 'aphront-dark-console-css' => '6378ef3d', 'aphront-dialog-view-css' => 'd2e76b88', - 'aphront-list-filter-view-css' => '2ae43867', + 'aphront-list-filter-view-css' => '18b7e144', 'aphront-multi-column-view-css' => 'fd18389d', 'aphront-pager-view-css' => '2e3539af', 'aphront-panel-view-css' => '8427b78d', @@ -515,7 +515,7 @@ return array( 'config-options-css' => '7fedf08b', 'config-welcome-css' => '6abd79be', 'conpherence-durable-column-view' => 'caa12d4a', - 'conpherence-menu-css' => 'beef0920', + 'conpherence-menu-css' => '7c900089', 'conpherence-message-pane-css' => '44154798', 'conpherence-notification-css' => '04a6e10a', 'conpherence-thread-manager' => 'bb928342', @@ -557,7 +557,7 @@ return array( 'javelin-behavior-boards-dropdown' => '0ec56e1d', 'javelin-behavior-choose-control' => '6153c708', 'javelin-behavior-config-reorder-fields' => '14a827de', - 'javelin-behavior-conpherence-menu' => 'de5579b4', + 'javelin-behavior-conpherence-menu' => 'cda6de80', 'javelin-behavior-conpherence-pontificate' => '21ba5861', 'javelin-behavior-conpherence-widget-pane' => '1ec93bcf', 'javelin-behavior-countdown-timer' => 'e4cc26b3', @@ -729,7 +729,7 @@ return array( 'phabricator-hovercard-view-css' => '893f4783', 'phabricator-keyboard-shortcut' => '1ae869f2', 'phabricator-keyboard-shortcut-manager' => 'c1700f6f', - 'phabricator-main-menu-view' => 'cfa2ec0f', + 'phabricator-main-menu-view' => '361a51f9', 'phabricator-nav-view-css' => '7aeaf435', 'phabricator-notification' => '0c6946e7', 'phabricator-notification-css' => '9c279160', @@ -1755,6 +1755,18 @@ return array( 'javelin-stratcom', 'phabricator-phtize', ), + 'cda6de80' => array( + 'javelin-behavior', + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-workflow', + 'javelin-behavior-device', + 'javelin-history', + 'javelin-vector', + 'phabricator-shaped-request', + 'conpherence-thread-manager', + ), 'd19198c8' => array( 'javelin-install', 'javelin-dom', @@ -1807,18 +1819,6 @@ return array( 'javelin-typeahead-ondemand-source', 'javelin-dom', ), - 'de5579b4' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-workflow', - 'javelin-behavior-device', - 'javelin-history', - 'javelin-vector', - 'phabricator-shaped-request', - 'conpherence-thread-manager', - ), 'e10f8e18' => array( 'javelin-behavior', 'javelin-dom', diff --git a/src/applications/conpherence/controller/ConpherenceNewController.php b/src/applications/conpherence/controller/ConpherenceNewController.php index a08b105008..a887404c7d 100644 --- a/src/applications/conpherence/controller/ConpherenceNewController.php +++ b/src/applications/conpherence/controller/ConpherenceNewController.php @@ -53,25 +53,9 @@ final class ConpherenceNewController extends ConpherenceController { } } - - $participant_handles = array(); - if ($participants) { - $participant_handles = id(new PhabricatorHandleQuery()) - ->setViewer($user) - ->withPHIDs($participants) - ->execute(); - } - $submit_uri = $this->getApplicationURI('new/'); $cancel_uri = $this->getApplicationURI(); - // TODO - we can get a better cancel_uri once we get better at crazy - // ajax jonx T2086 - if ($participant_prefill) { - $handle = $participant_handles[$participant_prefill]; - $cancel_uri = $handle->getURI(); - } - $dialog = id(new AphrontDialogView()) ->setWidth(AphrontDialogView::WIDTH_FORM) ->setErrors($errors) @@ -80,17 +64,17 @@ final class ConpherenceNewController extends ConpherenceController { ->addCancelButton($cancel_uri) ->addSubmitButton(pht('Send Message')); - $form = id(new PHUIFormLayoutView()) + $form = id(new AphrontFormView()) ->setUser($user) ->setFullWidth(true) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) - ->setName('participants') - ->setValue($participant_handles) - ->setUser($user) - ->setDatasource(new PhabricatorPeopleDatasource()) - ->setLabel(pht('To')) - ->setError($e_participants)) + ->setName('participants') + ->setValue($participants) + ->setUser($user) + ->setDatasource(new PhabricatorPeopleDatasource()) + ->setLabel(pht('To')) + ->setError($e_participants)) ->appendChild( id(new PhabricatorRemarkupControl()) ->setUser($user) @@ -99,7 +83,7 @@ final class ConpherenceNewController extends ConpherenceController { ->setLabel(pht('Message')) ->setError($e_message)); - $dialog->appendChild($form); + $dialog->appendForm($form); return id(new AphrontDialogResponse())->setDialog($dialog); } diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index 3b67b6c1df..e2c82e9318 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -225,14 +225,14 @@ final class ConpherenceUpdateController $user = $request->getUser(); $add_person = $request->getStr('add_person'); - $form = id(new PHUIFormLayoutView()) + $form = id(new AphrontFormView()) ->setUser($user) ->setFullWidth(true) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) - ->setName('add_person') - ->setUser($user) - ->setDatasource(new PhabricatorPeopleDatasource())); + ->setName('add_person') + ->setUser($user) + ->setDatasource(new PhabricatorPeopleDatasource())); require_celerity_resource('conpherence-update-css'); $view = id(new AphrontDialogView()) @@ -241,7 +241,7 @@ final class ConpherenceUpdateController ->addHiddenInput( 'latest_transaction_id', $request->getInt('latest_transaction_id')) - ->appendChild($form); + ->appendForm($form); if ($request->getExists('minimal_display')) { $view->addHiddenInput('minimal_display', true); diff --git a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php index 4c15049845..822b41e440 100644 --- a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php +++ b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php @@ -52,18 +52,15 @@ final class ConpherenceThreadSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved) { - $phids = $saved->getParameter('participantPHIDs', array()); - $participant_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); + $participant_phids = $saved->getParameter('participantPHIDs', array()); + $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) - ->setDatasource(new PhabricatorPeopleDatasource()) - ->setName('participants') - ->setLabel(pht('Participants')) - ->setValue($participant_handles)); + ->setDatasource(new PhabricatorPeopleDatasource()) + ->setName('participants') + ->setLabel(pht('Participants')) + ->setValue($participant_phids)); } protected function getURI($path) { diff --git a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php index f15c1a2012..c9af9791a2 100644 --- a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php +++ b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php @@ -40,21 +40,17 @@ final class PhabricatorCountdownSearchEngine public function buildSearchForm( AphrontFormView $form, PhabricatorSavedQuery $saved_query) { - $phids = $saved_query->getParameter('authorPHIDs', array()); - $author_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); + $author_phids = $saved_query->getParameter('authorPHIDs', array()); $upcoming = $saved_query->getParameter('upcoming'); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) - ->setValue($author_handles)) + ->setValue($author_phids)) ->appendChild( id(new AphrontFormCheckboxControl()) ->addCheckbox( diff --git a/src/applications/differential/controller/DifferentialDiffCreateController.php b/src/applications/differential/controller/DifferentialDiffCreateController.php index e23f6cf718..c2d598cad9 100644 --- a/src/applications/differential/controller/DifferentialDiffCreateController.php +++ b/src/applications/differential/controller/DifferentialDiffCreateController.php @@ -28,7 +28,6 @@ final class DifferentialDiffCreateController extends DifferentialController { // This object is just for policy stuff $diff_object = DifferentialDiff::initializeNewDiff($viewer); $repository_phid = null; - $repository_value = array(); $errors = array(); $e_diff = null; $e_file = null; @@ -62,7 +61,8 @@ final class DifferentialDiffCreateController extends DifferentialController { array( 'diff' => $diff, 'repositoryPHID' => $repository_phid, - 'viewPolicy' => $request->getStr('viewPolicy'),)); + 'viewPolicy' => $request->getStr('viewPolicy'), + )); $call->setUser($viewer); $result = $call->execute(); @@ -93,10 +93,6 @@ final class DifferentialDiffCreateController extends DifferentialController { $cancel_uri = $this->getApplicationURI(); - if ($repository_phid) { - $repository_value = $this->loadViewerHandles(array($repository_phid)); - } - $policies = id(new PhabricatorPolicyQuery()) ->setViewer($viewer) ->setObject($diff_object) @@ -148,6 +144,12 @@ final class DifferentialDiffCreateController extends DifferentialController { ->setValue($revision_handle->renderLink())); } + if ($repository_phid) { + $repository_value = array($repository_phid); + } else { + $repository_value = array(); + } + $form ->appendChild( id(new AphrontFormTextAreaControl()) @@ -161,20 +163,20 @@ final class DifferentialDiffCreateController extends DifferentialController { ->setLabel(pht('Raw Diff From File')) ->setName('diff-file') ->setError($e_file)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) - ->setName(id(new DifferentialRepositoryField())->getFieldKey()) - ->setLabel(pht('Repository')) - ->setDatasource(new DiffusionRepositoryDatasource()) - ->setValue($repository_value) - ->setLimit(1)) + ->setName(id(new DifferentialRepositoryField())->getFieldKey()) + ->setLabel(pht('Repository')) + ->setDatasource(new DiffusionRepositoryDatasource()) + ->setValue($repository_value) + ->setLimit(1)) ->appendChild( id(new AphrontFormPolicyControl()) - ->setUser($viewer) - ->setName('viewPolicy') - ->setPolicyObject($diff_object) - ->setPolicies($policies) - ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)) + ->setUser($viewer) + ->setName('viewPolicy') + ->setPolicyObject($diff_object) + ->setPolicies($policies) + ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)) ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton($cancel_uri) diff --git a/src/applications/differential/customfield/DifferentialProjectsField.php b/src/applications/differential/customfield/DifferentialProjectsField.php index ee50d1bd5e..a784b98247 100644 --- a/src/applications/differential/customfield/DifferentialProjectsField.php +++ b/src/applications/differential/customfield/DifferentialProjectsField.php @@ -49,15 +49,12 @@ final class DifferentialProjectsField $this->setValue($request->getArr($this->getFieldKey())); } - public function getRequiredHandlePHIDsForEdit() { - return $this->getValue(); - } - public function renderEditControl(array $handles) { return id(new AphrontFormTokenizerControl()) + ->setUser($this->getViewer()) ->setName($this->getFieldKey()) ->setDatasource(new PhabricatorProjectDatasource()) - ->setValue($handles) + ->setValue($this->getValue()) ->setLabel($this->getFieldName()); } diff --git a/src/applications/differential/customfield/DifferentialRepositoryField.php b/src/applications/differential/customfield/DifferentialRepositoryField.php index ee520fd179..76f40d0957 100644 --- a/src/applications/differential/customfield/DifferentialRepositoryField.php +++ b/src/applications/differential/customfield/DifferentialRepositoryField.php @@ -32,25 +32,18 @@ final class DifferentialRepositoryField $this->setValue(nonempty($first, null)); } - public function getRequiredHandlePHIDsForEdit() { - $phids = array(); - if ($this->getValue()) { - $phids[] = $this->getValue(); - } - return $phids; - } - public function renderEditControl(array $handles) { if ($this->getValue()) { - $control_value = array_select_keys($handles, array($this->getValue())); + $value = array($this->getValue()); } else { - $control_value = array(); + $value = array(); } return id(new AphrontFormTokenizerControl()) + ->setUser($this->getViewer()) ->setName($this->getFieldKey()) ->setDatasource(new DiffusionRepositoryDatasource()) - ->setValue($control_value) + ->setValue($value) ->setError($this->getFieldError()) ->setLabel($this->getFieldName()) ->setLimit(1); diff --git a/src/applications/differential/customfield/DifferentialReviewersField.php b/src/applications/differential/customfield/DifferentialReviewersField.php index d0794a37e2..9ab77c26ac 100644 --- a/src/applications/differential/customfield/DifferentialReviewersField.php +++ b/src/applications/differential/customfield/DifferentialReviewersField.php @@ -62,19 +62,17 @@ final class DifferentialReviewersField $this->setValue($new_status); } - public function getRequiredHandlePHIDsForEdit() { + public function renderEditControl(array $handles) { $phids = array(); if ($this->getValue()) { $phids = mpull($this->getValue(), 'getReviewerPHID'); } - return $phids; - } - public function renderEditControl(array $handles) { return id(new AphrontFormTokenizerControl()) + ->setUser($this->getViewer()) ->setName($this->getFieldKey()) ->setDatasource(new PhabricatorProjectOrUserDatasource()) - ->setValue($handles) + ->setValue($phids) ->setError($this->getFieldError()) ->setLabel($this->getFieldName()); } diff --git a/src/applications/differential/customfield/DifferentialSubscribersField.php b/src/applications/differential/customfield/DifferentialSubscribersField.php index cb558fd021..dac2040d77 100644 --- a/src/applications/differential/customfield/DifferentialSubscribersField.php +++ b/src/applications/differential/customfield/DifferentialSubscribersField.php @@ -37,15 +37,12 @@ final class DifferentialSubscribersField $this->setValue($request->getArr($this->getFieldKey())); } - public function getRequiredHandlePHIDsForEdit() { - return $this->getValue(); - } - public function renderEditControl(array $handles) { return id(new AphrontFormTokenizerControl()) + ->setUser($this->getViewer()) ->setName($this->getFieldKey()) ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) - ->setValue($handles) + ->setValue($this->getValue()) ->setError($this->getFieldError()) ->setLabel($this->getFieldName()); } diff --git a/src/applications/differential/query/DifferentialRevisionSearchEngine.php b/src/applications/differential/query/DifferentialRevisionSearchEngine.php index 65afcd55a6..22bfe35312 100644 --- a/src/applications/differential/query/DifferentialRevisionSearchEngine.php +++ b/src/applications/differential/query/DifferentialRevisionSearchEngine.php @@ -124,51 +124,37 @@ final class DifferentialRevisionSearchEngine $repository_phids = $saved->getParameter('repositoryPHIDs', array()); $only_draft = $saved->getParameter('draft', false); - $all_phids = array_mergev( - array( - $responsible_phids, - $author_phids, - $reviewer_phids, - $subscriber_phids, - $repository_phids, - )); - - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($all_phids) - ->execute(); - $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Responsible Users')) ->setName('responsibles') ->setDatasource(new PhabricatorPeopleDatasource()) - ->setValue(array_select_keys($handles, $responsible_phids))) - ->appendChild( + ->setValue($responsible_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Authors')) ->setName('authors') ->setDatasource(new PhabricatorPeopleDatasource()) - ->setValue(array_select_keys($handles, $author_phids))) - ->appendChild( + ->setValue($author_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Reviewers')) ->setName('reviewers') ->setDatasource(new PhabricatorProjectOrUserDatasource()) - ->setValue(array_select_keys($handles, $reviewer_phids))) - ->appendChild( + ->setValue($reviewer_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Subscribers')) ->setName('subscribers') ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) - ->setValue(array_select_keys($handles, $subscriber_phids))) - ->appendChild( + ->setValue($subscriber_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Repositories')) ->setName('repositories') ->setDatasource(new DiffusionRepositoryDatasource()) - ->setValue(array_select_keys($handles, $repository_phids))) + ->setValue($repository_phids)) ->appendChild( id(new AphrontFormSelectControl()) ->setLabel(pht('Status')) diff --git a/src/applications/differential/view/DifferentialAddCommentView.php b/src/applications/differential/view/DifferentialAddCommentView.php index cc84d6034a..e61065c4ec 100644 --- a/src/applications/differential/view/DifferentialAddCommentView.php +++ b/src/applications/differential/view/DifferentialAddCommentView.php @@ -80,7 +80,7 @@ final class DifferentialAddCommentView extends AphrontView { ->setValue($action) ->setID('comment-action') ->setOptions($this->actions)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel($enable_reviewers ? $add_reviewers_labels[$action] : $add_reviewers_labels['add_reviewers']) @@ -89,7 +89,7 @@ final class DifferentialAddCommentView extends AphrontView { ->setControlStyle($enable_reviewers ? null : 'display: none') ->setID('add-reviewers-tokenizer') ->setDisableBehavior(true)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Add Subscribers')) ->setName('ccs') diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 87505bd30e..96d10a77b8 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -687,7 +687,7 @@ final class DiffusionCommitController extends DiffusionController { ->setName('action') ->setID('audit-action') ->setOptions($actions)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Add Auditors')) ->setName('auditors') @@ -695,7 +695,7 @@ final class DiffusionCommitController extends DiffusionController { ->setControlStyle('display: none') ->setID('add-auditors-tokenizer') ->setDisableBehavior(true)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Add CCs')) ->setName('ccs') diff --git a/src/applications/diffusion/controller/DiffusionCommitEditController.php b/src/applications/diffusion/controller/DiffusionCommitEditController.php index 84b82fb15e..c9526883e0 100644 --- a/src/applications/diffusion/controller/DiffusionCommitEditController.php +++ b/src/applications/diffusion/controller/DiffusionCommitEditController.php @@ -15,13 +15,11 @@ final class DiffusionCommitEditController extends DiffusionController { return new Aphront404Response(); } - $commit_phid = $commit->getPHID(); - $edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; + $commit_phid = $commit->getPHID(); + $edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( $commit_phid, $edge_type); - $handles = $this->loadViewerHandles($current_proj_phids); - $proj_t_values = $handles; if ($request->isFormPost()) { $xactions = array(); @@ -36,18 +34,18 @@ final class DiffusionCommitEditController extends DiffusionController { ->setContentSourceFromRequest($request); $xactions = $editor->applyTransactions($commit, $xactions); return id(new AphrontRedirectResponse()) - ->setURI('/r'.$callsign.$commit->getCommitIdentifier()); + ->setURI('/r'.$callsign.$commit->getCommitIdentifier()); } $tokenizer_id = celerity_generate_unique_node_id(); $form = id(new AphrontFormView()) ->setUser($user) ->setAction($request->getRequestURI()->getPath()) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Projects')) ->setName('projects') - ->setValue($proj_t_values) + ->setValue($current_proj_phids) ->setID($tokenizer_id) ->setCaption( javelin_tag( diff --git a/src/applications/diffusion/controller/DiffusionLintController.php b/src/applications/diffusion/controller/DiffusionLintController.php index 5f51d31fe7..43dfdedaee 100644 --- a/src/applications/diffusion/controller/DiffusionLintController.php +++ b/src/applications/diffusion/controller/DiffusionLintController.php @@ -24,7 +24,6 @@ final class DiffusionLintController extends DiffusionController { } else { $owners = array(head($request->getArr('owner'))); } - $owner_handles = $this->loadViewerHandles($owners); } $codes = $this->loadLintCodes($owners); @@ -108,13 +107,13 @@ final class DiffusionLintController extends DiffusionController { $form = id(new AphrontFormView()) ->setUser($user) ->setMethod('GET') - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setLimit(1) ->setName('owner') ->setLabel(pht('Owner')) - ->setValue($owner_handles)) + ->setValue($owners)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue('Filter')); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php index ecaef31297..986f46cec5 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php @@ -92,7 +92,6 @@ final class DiffusionRepositoryEditBasicController $crumbs->addTextCrumb(pht('Edit Basics')); $title = pht('Edit %s', $repository->getName()); - $project_handles = $this->loadViewerHandles($repository->getProjectPHIDs()); $form = id(new AphrontFormView()) ->setUser($user) @@ -123,12 +122,12 @@ final class DiffusionRepositoryEditBasicController ->setName('description') ->setLabel(pht('Description')) ->setValue($v_desc)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectDatasource()) ->setName('projectPHIDs') ->setLabel(pht('Projects')) - ->setValue($project_handles)) + ->setValue($repository->getProjectPHIDs())) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Save')) diff --git a/src/applications/feed/query/PhabricatorFeedSearchEngine.php b/src/applications/feed/query/PhabricatorFeedSearchEngine.php index 49d65770bd..cfa080d1b1 100644 --- a/src/applications/feed/query/PhabricatorFeedSearchEngine.php +++ b/src/applications/feed/query/PhabricatorFeedSearchEngine.php @@ -68,30 +68,21 @@ final class PhabricatorFeedSearchEngine $user_phids = $saved_query->getParameter('userPHIDs', array()); $proj_phids = $saved_query->getParameter('projectPHIDs', array()); - - $phids = array_merge($user_phids, $proj_phids); - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); - $user_handles = array_select_keys($handles, $user_phids); - $proj_handles = array_select_keys($handles, $proj_phids); - $viewer_projects = $saved_query->getParameter('viewerProjects'); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('users') ->setLabel(pht('Include Users')) - ->setValue($user_handles)) - ->appendChild( + ->setValue($user_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectDatasource()) ->setName('projectPHIDs') ->setLabel(pht('Include Projects')) - ->setValue($proj_handles)) + ->setValue($proj_phids)) ->appendChild( id(new AphrontFormCheckboxControl()) ->addCheckbox( diff --git a/src/applications/files/query/PhabricatorFileSearchEngine.php b/src/applications/files/query/PhabricatorFileSearchEngine.php index 39e093cb86..86df8b7b6d 100644 --- a/src/applications/files/query/PhabricatorFileSearchEngine.php +++ b/src/applications/files/query/PhabricatorFileSearchEngine.php @@ -54,21 +54,16 @@ final class PhabricatorFileSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved_query) { - $phids = $saved_query->getParameter('authorPHIDs', array()); - $author_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); - + $author_phids = $saved_query->getParameter('authorPHIDs', array()); $explicit = $saved_query->getParameter('explicit'); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) - ->setValue($author_handles)) + ->setValue($author_phids)) ->appendChild( id(new AphrontFormCheckboxControl()) ->addCheckbox( diff --git a/src/applications/fund/controller/FundInitiativeEditController.php b/src/applications/fund/controller/FundInitiativeEditController.php index 5b3adf1679..b63b4d6d6b 100644 --- a/src/applications/fund/controller/FundInitiativeEditController.php +++ b/src/applications/fund/controller/FundInitiativeEditController.php @@ -138,12 +138,6 @@ final class FundInitiativeEditController ->setObject($initiative) ->execute(); - if ($v_projects) { - $project_handles = $this->loadViewerHandles($v_projects); - } else { - $project_handles = array(); - } - $merchants = id(new PhortuneMerchantQuery()) ->setViewer($viewer) ->requireCapabilities( @@ -210,11 +204,11 @@ final class FundInitiativeEditController ->setName('risks') ->setLabel(pht('Risks/Challenges')) ->setValue($v_risk)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Projects')) ->setName('projects') - ->setValue($project_handles) + ->setValue($v_projects) ->setDatasource(new PhabricatorProjectDatasource())) ->appendChild( id(new AphrontFormPolicyControl()) diff --git a/src/applications/fund/query/FundBackerSearchEngine.php b/src/applications/fund/query/FundBackerSearchEngine.php index 563838a954..d1b7e64a23 100644 --- a/src/applications/fund/query/FundBackerSearchEngine.php +++ b/src/applications/fund/query/FundBackerSearchEngine.php @@ -56,26 +56,15 @@ final class FundBackerSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved) { - $backer_phids = $saved->getParameter('backerPHIDs', array()); - $all_phids = array_mergev( - array( - $backer_phids, - )); - - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($all_phids) - ->execute(); - $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Backers')) ->setName('backers') ->setDatasource(new PhabricatorPeopleDatasource()) - ->setValue(array_select_keys($handles, $backer_phids))); + ->setValue($backer_phids)); } protected function getURI($path) { diff --git a/src/applications/fund/query/FundInitiativeSearchEngine.php b/src/applications/fund/query/FundInitiativeSearchEngine.php index 52c97e7a95..0f02f67ac8 100644 --- a/src/applications/fund/query/FundInitiativeSearchEngine.php +++ b/src/applications/fund/query/FundInitiativeSearchEngine.php @@ -51,16 +51,6 @@ final class FundInitiativeSearchEngine $owner_phids = $saved->getParameter('ownerPHIDs', array()); - $all_phids = array_mergev( - array( - $owner_phids, - )); - - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($all_phids) - ->execute(); - $status_map = FundInitiative::getStatusNameMap(); $status_control = id(new AphrontFormCheckboxControl()) ->setLabel(pht('Statuses')); @@ -73,12 +63,12 @@ final class FundInitiativeSearchEngine } $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Owners')) ->setName('owners') ->setDatasource(new PhabricatorPeopleDatasource()) - ->setValue(array_select_keys($handles, $owner_phids))) + ->setValue($owner_phids)) ->appendChild($status_control); } diff --git a/src/applications/harbormaster/controller/HarbormasterStepEditController.php b/src/applications/harbormaster/controller/HarbormasterStepEditController.php index a7c4624dc9..ef9289a7c8 100644 --- a/src/applications/harbormaster/controller/HarbormasterStepEditController.php +++ b/src/applications/harbormaster/controller/HarbormasterStepEditController.php @@ -68,12 +68,7 @@ final class HarbormasterStepEditController extends HarbormasterController { $e_description = true; $v_description = $step->getDescription(); $e_depends_on = true; - $raw_depends_on = $step->getDetail('dependsOn', array()); - - $v_depends_on = id(new PhabricatorHandleQuery()) - ->setViewer($viewer) - ->withPHIDs($raw_depends_on) - ->execute(); + $v_depends_on = $step->getDetail('dependsOn', array()); $errors = array(); $validation_exception = null; @@ -138,7 +133,7 @@ final class HarbormasterStepEditController extends HarbormasterController { ->setValue($v_name)); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(id(new HarbormasterBuildDependencyDatasource()) ->setParameters(array( diff --git a/src/applications/herald/query/HeraldRuleSearchEngine.php b/src/applications/herald/query/HeraldRuleSearchEngine.php index dace06725d..4c7364588b 100644 --- a/src/applications/herald/query/HeraldRuleSearchEngine.php +++ b/src/applications/herald/query/HeraldRuleSearchEngine.php @@ -58,22 +58,17 @@ final class HeraldRuleSearchEngine extends PhabricatorApplicationSearchEngine { AphrontFormView $form, PhabricatorSavedQuery $saved_query) { - $phids = $saved_query->getParameter('authorPHIDs', array()); - $author_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); - + $author_phids = $saved_query->getParameter('authorPHIDs', array()); $content_type = $saved_query->getParameter('contentType'); $rule_type = $saved_query->getParameter('ruleType'); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) - ->setValue($author_handles)) + ->setValue($author_phids)) ->appendChild( id(new AphrontFormSelectControl()) ->setName('contentType') diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php b/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php index 662d608aea..73c9480600 100644 --- a/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php +++ b/src/applications/legalpad/controller/LegalpadDocumentSignatureAddController.php @@ -117,15 +117,14 @@ final class LegalpadDocumentSignatureAddController extends LegalpadController { ->setUser($viewer); if ($is_individual) { - $user_handles = $this->loadViewerHandles($v_users); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Exempt User')) ->setName('users') ->setLimit(1) ->setDatasource(new PhabricatorPeopleDatasource()) - ->setValue($user_handles) + ->setValue($v_users) ->setError($e_user)); } else { $form diff --git a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php index 104da068a8..84abe3fdd1 100644 --- a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php @@ -73,11 +73,6 @@ final class LegalpadDocumentSearchEngine $creator_phids = $saved_query->getParameter('creatorPHIDs', array()); $contributor_phids = $saved_query->getParameter( 'contributorPHIDs', array()); - $phids = array_merge($creator_phids, $contributor_phids); - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); $viewer_signature = $saved_query->getParameter('withViewerSignature'); if (!$this->requireViewer()->getPHID()) { @@ -93,18 +88,18 @@ final class LegalpadDocumentSearchEngine pht('Show only documents I have signed.'), $viewer_signature) ->setDisabled(!$this->requireViewer()->getPHID())) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('creators') ->setLabel(pht('Creators')) - ->setValue(array_select_keys($handles, $creator_phids))) - ->appendChild( + ->setValue($creator_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('contributors') ->setLabel(pht('Contributors')) - ->setValue(array_select_keys($handles, $contributor_phids))); + ->setValue($contributor_phids)); $this->buildDateRange( $form, diff --git a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php index c878d92ce4..48cc1b94b6 100644 --- a/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php @@ -77,32 +77,26 @@ final class LegalpadDocumentSignatureSearchEngine $document_phids = $saved_query->getParameter('documentPHIDs', array()); $signer_phids = $saved_query->getParameter('signerPHIDs', array()); - $phids = array_merge($document_phids, $signer_phids); - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); - if (!$this->document) { $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new LegalpadDocumentDatasource()) ->setName('documents') ->setLabel(pht('Documents')) - ->setValue(array_select_keys($handles, $document_phids))); + ->setValue($document_phids)); } $name_contains = $saved_query->getParameter('nameContains', ''); $email_contains = $saved_query->getParameter('emailContains', ''); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('signers') ->setLabel(pht('Signers')) - ->setValue(array_select_keys($handles, $signer_phids))) + ->setValue($signer_phids)) ->appendChild( id(new AphrontFormTextControl()) ->setLabel(pht('Name Contains')) diff --git a/src/applications/macro/controller/PhabricatorMacroMemeDialogController.php b/src/applications/macro/controller/PhabricatorMacroMemeDialogController.php index 65ffd39991..25a223f5ac 100644 --- a/src/applications/macro/controller/PhabricatorMacroMemeDialogController.php +++ b/src/applications/macro/controller/PhabricatorMacroMemeDialogController.php @@ -44,8 +44,9 @@ final class PhabricatorMacroMemeDialogController } } - $view = id(new PHUIFormLayoutView()) - ->appendChild( + $view = id(new AphrontFormView()) + ->setUser($user) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Macro')) ->setName('macro') @@ -66,9 +67,9 @@ final class PhabricatorMacroMemeDialogController $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Create Meme')) - ->appendChild($view) + ->appendForm($view) ->addCancelButton('/') - ->addSubmitButton(pht('rofllolo!!~')); + ->addSubmitButton(pht('Llama Diorama')); return id(new AphrontDialogResponse())->setDialog($dialog); } diff --git a/src/applications/macro/query/PhabricatorMacroSearchEngine.php b/src/applications/macro/query/PhabricatorMacroSearchEngine.php index 8e00c45f17..9207685dc5 100644 --- a/src/applications/macro/query/PhabricatorMacroSearchEngine.php +++ b/src/applications/macro/query/PhabricatorMacroSearchEngine.php @@ -74,12 +74,7 @@ final class PhabricatorMacroSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved_query) { - $phids = $saved_query->getParameter('authorPHIDs', array()); - $author_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); - + $author_phids = $saved_query->getParameter('authorPHIDs', array()); $status = $saved_query->getParameter('status'); $names = implode(', ', $saved_query->getParameter('names', array())); $like = $saved_query->getParameter('nameLike'); @@ -92,12 +87,12 @@ final class PhabricatorMacroSearchEngine ->setLabel(pht('Status')) ->setOptions(PhabricatorMacroQuery::getStatusOptions()) ->setValue($status)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) - ->setValue($author_handles)) + ->setValue($author_phids)) ->appendChild( id(new AphrontFormTextControl()) ->setName('nameLike') diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index 2fd0d90873..f0b1c37110 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -320,13 +320,14 @@ final class ManiphestReportController extends ManiphestController { $form = id(new AphrontFormView()) ->setUser($user) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectDatasource()) ->setLabel(pht('Project')) ->setLimit(1) ->setName('set_project') - ->setValue($tokens)); + // TODO: This is silly, but this is Maniphest reports. + ->setValue(mpull($tokens, 'getPHID'))); if ($has_window) { list($window_str, $ignored, $window_error) = $this->getWindow(); diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index 147e9dfc6e..24c98ba24f 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -202,7 +202,7 @@ final class ManiphestTaskDetailController extends ManiphestController { ->setControlID('resolution') ->setControlStyle('display: none') ->setOptions($resolution_types)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Assign To')) ->setName('assign_to') @@ -210,7 +210,7 @@ final class ManiphestTaskDetailController extends ManiphestController { ->setControlStyle('display: none') ->setID('assign-tokenizer') ->setDisableBehavior(true)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('CCs')) ->setName('ccs') @@ -226,7 +226,7 @@ final class ManiphestTaskDetailController extends ManiphestController { ->setControlID('priority') ->setControlStyle('display: none') ->setValue($task->getPriority())) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Projects')) ->setName('projects') diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 1912b94810..915ea6c33a 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -506,20 +506,6 @@ final class ManiphestTaskEditController extends ManiphestController { } } - $phids = array_merge( - array($task->getOwnerPHID()), - $task->getSubscriberPHIDs(), - $task->getProjectPHIDs()); - - if ($parent_task) { - $phids[] = $parent_task->getPHID(); - } - - $phids = array_filter($phids); - $phids = array_unique($phids); - - $handles = $this->loadViewerHandles($phids); - $error_view = null; if ($errors) { $error_view = new PHUIInfoView(); @@ -529,19 +515,19 @@ final class ManiphestTaskEditController extends ManiphestController { $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); if ($task->getOwnerPHID()) { - $assigned_value = array($handles[$task->getOwnerPHID()]); + $assigned_value = array($task->getOwnerPHID()); } else { $assigned_value = array(); } if ($task->getSubscriberPHIDs()) { - $cc_value = array_select_keys($handles, $task->getSubscriberPHIDs()); + $cc_value = $task->getSubscriberPHIDs(); } else { $cc_value = array(); } if ($task->getProjectPHIDs()) { - $projects_value = array_select_keys($handles, $task->getProjectPHIDs()); + $projects_value = $task->getProjectPHIDs(); } else { $projects_value = array(); } @@ -583,7 +569,7 @@ final class ManiphestTaskEditController extends ManiphestController { ->appendChild( id(new AphrontFormStaticControl()) ->setLabel(pht('Parent Task')) - ->setValue($handles[$parent_task->getPHID()]->getFullName())) + ->setValue($user->renderHandle($parent_task->getPHID()))) ->addHiddenInput('parent', $parent_task->getID()); } @@ -620,7 +606,7 @@ final class ManiphestTaskEditController extends ManiphestController { ->execute(); if ($can_edit_assign) { - $form->appendChild( + $form->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Assigned To')) ->setName('assigned_to') @@ -631,7 +617,7 @@ final class ManiphestTaskEditController extends ManiphestController { } $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('CC')) ->setName('cc') @@ -680,7 +666,7 @@ final class ManiphestTaskEditController extends ManiphestController { pht('Create New Project')); } $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Projects')) ->setName('projects') diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php index 7ad2a09d5b..8230971a4b 100644 --- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php +++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php @@ -258,34 +258,6 @@ final class ManiphestTaskSearchEngine array()); $subscriber_phids = $saved->getParameter('subscriberPHIDs', array()); - $all_phids = array_merge( - $assigned_phids, - $author_phids, - $all_project_phids, - $any_project_phids, - $exclude_project_phids, - $user_project_phids, - $subscriber_phids); - - if ($all_phids) { - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($all_phids) - ->execute(); - } else { - $handles = array(); - } - - $assigned_handles = array_select_keys($handles, $assigned_phids); - $author_handles = array_select_keys($handles, $author_phids); - $all_project_handles = array_select_keys($handles, $all_project_phids); - $any_project_handles = array_select_keys($handles, $any_project_phids); - $exclude_project_handles = array_select_keys( - $handles, - $exclude_project_phids); - $user_project_handles = array_select_keys($handles, $user_project_phids); - $subscriber_handles = array_select_keys($handles, $subscriber_phids); - $with_unassigned = $saved->getParameter('withUnassigned'); $with_no_projects = $saved->getParameter('withNoProject'); @@ -320,7 +292,9 @@ final class ManiphestTaskSearchEngine ->setOptions(array( '' => pht('Show All Tasks'), 'true' => pht('Show Tasks Blocking Other Tasks'), - 'false' => pht('Show Tasks Not Blocking Other Tasks'),)); + 'false' => pht('Show Tasks Not Blocking Other Tasks'), + )); + $blocked_control = id(new AphrontFormSelectControl()) ->setLabel(pht('Blocked')) ->setName('blocked') @@ -328,7 +302,8 @@ final class ManiphestTaskSearchEngine ->setOptions(array( '' => pht('Show All Tasks'), 'true' => pht('Show Tasks Blocked By Other Tasks'), - 'false' => pht('Show Tasks Not Blocked By Other Tasks'),)); + 'false' => pht('Show Tasks Not Blocked By Other Tasks'), + )); $ids = $saved->getParameter('ids', array()); @@ -337,12 +312,12 @@ final class ManiphestTaskSearchEngine $all_orders = $builtin_orders + $custom_orders; $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('assigned') ->setLabel(pht('Assigned To')) - ->setValue($assigned_handles)) + ->setValue($assigned_phids)) ->appendChild( id(new AphrontFormCheckboxControl()) ->addCheckbox( @@ -350,12 +325,12 @@ final class ManiphestTaskSearchEngine 1, pht('Show only unassigned tasks.'), $with_unassigned)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectDatasource()) ->setName('allProjects') ->setLabel(pht('In All Projects')) - ->setValue($all_project_handles)); + ->setValue($all_project_phids)); if (!$this->getIsBoardView()) { $form @@ -369,36 +344,36 @@ final class ManiphestTaskSearchEngine } $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectDatasource()) ->setName('anyProjects') ->setLabel(pht('In Any Project')) - ->setValue($any_project_handles)) - ->appendChild( + ->setValue($any_project_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectDatasource()) ->setName('excludeProjects') ->setLabel(pht('Not In Projects')) - ->setValue($exclude_project_handles)) - ->appendChild( + ->setValue($exclude_project_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('userProjects') ->setLabel(pht('In Users\' Projects')) - ->setValue($user_project_handles)) - ->appendChild( + ->setValue($user_project_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) - ->setValue($author_handles)) - ->appendChild( + ->setValue($author_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorMetaMTAMailableDatasource()) ->setName('subscribers') ->setLabel(pht('Subscribers')) - ->setValue($subscriber_handles)) + ->setValue($subscriber_phids)) ->appendChild( id(new AphrontFormTextControl()) ->setName('fulltext') diff --git a/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php b/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php index 636b022c26..80cb3f0313 100644 --- a/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php +++ b/src/applications/metamta/applicationpanel/PhabricatorMetaMTAApplicationEmailPanel.php @@ -301,15 +301,13 @@ final class PhabricatorMetaMTAApplicationEmailPanel $default_user = $email_object->getConfigValue($default_user_key); if ($default_user) { - $default_user_handle = id(new PhabricatorHandleQuery()) - ->setViewer($viewer) - ->withPHIDs(array($default_user)) - ->execute(); + $default_user_value = array($default_user); } else { - $default_user_handle = array(); + $default_user_value = array(); } - $form = id(new PHUIFormLayoutView()) + $form = id(new AphrontFormView()) + ->setUser($viewer) ->appendChild( id(new AphrontFormTextControl()) ->setLabel(pht('Email')) @@ -317,13 +315,13 @@ final class PhabricatorMetaMTAApplicationEmailPanel ->setValue($email_object->getAddress()) ->setCaption(PhabricatorUserEmail::describeAllowedAddresses()) ->setError($e_email)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setLabel(pht('Default Author')) ->setName($default_user_key) ->setLimit(1) - ->setValue($default_user_handle) + ->setValue($default_user_value) ->setCaption(pht( 'Used if the "From:" address does not map to a known account.'))); if ($is_new) { @@ -336,7 +334,7 @@ final class PhabricatorMetaMTAApplicationEmailPanel ->setWidth(AphrontDialogView::WIDTH_FORM) ->setTitle($title) ->appendChild($errors) - ->appendChild($form) + ->appendForm($form) ->addSubmitButton(pht('Save')) ->addCancelButton($uri); diff --git a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php index 634debc43e..bf4fdc5cf6 100644 --- a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php +++ b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php @@ -36,19 +36,15 @@ final class PhabricatorOAuthServerClientSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved_query) { - $phids = $saved_query->getParameter('creatorPHIDs', array()); - $creator_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); + $creator_phids = $saved_query->getParameter('creatorPHIDs', array()); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('creators') ->setLabel(pht('Creators')) - ->setValue($creator_handles)); + ->setValue($creator_phids)); } protected function getURI($path) { diff --git a/src/applications/owners/controller/PhabricatorOwnersEditController.php b/src/applications/owners/controller/PhabricatorOwnersEditController.php index 249b461fbb..34bf513737 100644 --- a/src/applications/owners/controller/PhabricatorOwnersEditController.php +++ b/src/applications/owners/controller/PhabricatorOwnersEditController.php @@ -114,17 +114,13 @@ final class PhabricatorOwnersEditController } } - $handles = $this->loadViewerHandles($owners); - $primary = $package->getPrimaryOwnerPHID(); - if ($primary && isset($handles[$primary])) { - $handle_primary_owner = array($handles[$primary]); + if ($primary) { + $value_primary_owner = array($primary); } else { - $handle_primary_owner = array(); + $value_primary_owner = array(); } - $handles_all_owners = array_select_keys($handles, $owners); - if ($package->getID()) { $title = pht('Edit Package'); $side_nav_filter = 'edit/'.$this->id; @@ -182,20 +178,20 @@ final class PhabricatorOwnersEditController ->setName('name') ->setValue($package->getName()) ->setError($e_name)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectOrUserDatasource()) ->setLabel(pht('Primary Owner')) ->setName('primary') ->setLimit(1) - ->setValue($handle_primary_owner) + ->setValue($value_primary_owner) ->setError($e_primary)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectOrUserDatasource()) ->setLabel(pht('Owners')) ->setName('owners') - ->setValue($handles_all_owners)) + ->setValue($owners)) ->appendChild( id(new AphrontFormSelectControl()) ->setName('auditing') diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php index 0d9041df80..8a3a1e8ec3 100644 --- a/src/applications/owners/controller/PhabricatorOwnersListController.php +++ b/src/applications/owners/controller/PhabricatorOwnersListController.php @@ -148,13 +148,7 @@ final class PhabricatorOwnersListController $filter = new AphrontListFilterView(); - $owners_search_value = array(); - if ($request->getArr('owner')) { - $phids = $request->getArr('owner'); - $phid = reset($phids); - $handles = $this->loadViewerHandles(array($phid)); - $owners_search_value = array($handles[$phid]); - } + $owner_phids = $request->getArr('owner'); $callsigns = array('' => pht('(Any Repository)')); $repositories = id(new PhabricatorRepositoryQuery()) @@ -175,13 +169,13 @@ final class PhabricatorOwnersListController ->setName('name') ->setLabel(pht('Name')) ->setValue($request->getStr('name'))) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectOrUserDatasource()) ->setLimit(1) ->setName('owner') ->setLabel(pht('Owner')) - ->setValue($owners_search_value)) + ->setValue($owner_phids)) ->appendChild( id(new AphrontFormSelectControl()) ->setName('repository') diff --git a/src/applications/paste/controller/PhabricatorPasteEditController.php b/src/applications/paste/controller/PhabricatorPasteEditController.php index 19652217b8..32cc465737 100644 --- a/src/applications/paste/controller/PhabricatorPasteEditController.php +++ b/src/applications/paste/controller/PhabricatorPasteEditController.php @@ -188,17 +188,11 @@ final class PhabricatorPasteEditController extends PhabricatorPasteController { ->setPolicies($policies) ->setName('can_edit')); - if ($v_projects) { - $project_handles = $this->loadViewerHandles($v_projects); - } else { - $project_handles = array(); - } - - $form->appendChild( + $form->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Projects')) ->setName('projects') - ->setValue($project_handles) + ->setValue($v_projects) ->setDatasource(new PhabricatorProjectDatasource())); $form diff --git a/src/applications/paste/query/PhabricatorPasteSearchEngine.php b/src/applications/paste/query/PhabricatorPasteSearchEngine.php index d2d677ea5a..45dad0799b 100644 --- a/src/applications/paste/query/PhabricatorPasteSearchEngine.php +++ b/src/applications/paste/query/PhabricatorPasteSearchEngine.php @@ -52,11 +52,7 @@ final class PhabricatorPasteSearchEngine public function buildSearchForm( AphrontFormView $form, PhabricatorSavedQuery $saved_query) { - $phids = $saved_query->getParameter('authorPHIDs', array()); - $author_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); + $author_phids = $saved_query->getParameter('authorPHIDs', array()); $languages = $saved_query->getParameter('languages', array()); $no_language = false; @@ -69,12 +65,12 @@ final class PhabricatorPasteSearchEngine } $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) - ->setValue($author_handles)) + ->setValue($author_phids)) ->appendChild( id(new AphrontFormTextControl()) ->setName('languages') diff --git a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php index 8e75efed6c..b98e29840b 100644 --- a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php +++ b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php @@ -89,22 +89,6 @@ final class PhabricatorPeopleLogSearchEngine $actor_phids = $saved->getParameter('actorPHIDs', array()); $user_phids = $saved->getParameter('userPHIDs', array()); - $all_phids = array_merge( - $actor_phids, - $user_phids); - - if ($all_phids) { - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($all_phids) - ->execute(); - } else { - $handles = array(); - } - - $actor_handles = array_select_keys($handles, $actor_phids); - $user_handles = array_select_keys($handles, $user_phids); - $actions = $saved->getParameter('actions', array()); $remote_prefix = $saved->getParameter('ip'); $sessions = $saved->getParameter('sessions', array()); @@ -122,18 +106,18 @@ final class PhabricatorPeopleLogSearchEngine } $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('actors') ->setLabel(pht('Actors')) - ->setValue($actor_handles)) - ->appendChild( + ->setValue($actor_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('users') ->setLabel(pht('Users')) - ->setValue($user_handles)) + ->setValue($user_phids)) ->appendChild($action_control) ->appendChild( id(new AphrontFormTextControl()) diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php index 7fed740bfc..357f4e49da 100644 --- a/src/applications/pholio/controller/PholioMockEditController.php +++ b/src/applications/pholio/controller/PholioMockEditController.php @@ -245,11 +245,6 @@ final class PholioMockEditController extends PholioController { $mock->setViewPolicy($v_view); $mock->setEditPolicy($v_edit); - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($user) - ->withPHIDs($v_cc) - ->execute(); - $image_elements = array(); if ($posted_mock_images) { $display_mock_images = $posted_mock_images; @@ -307,12 +302,6 @@ final class PholioMockEditController extends PholioController { ), )); - if ($v_projects) { - $project_handles = $this->loadViewerHandles($v_projects); - } else { - $project_handles = array(); - } - require_celerity_resource('pholio-edit-css'); $form = id(new AphrontFormView()) ->setUser($user) @@ -342,17 +331,17 @@ final class PholioMockEditController extends PholioController { } $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Projects')) ->setName('projects') - ->setValue($project_handles) + ->setValue($v_projects) ->setDatasource(new PhabricatorProjectDatasource())) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('CC')) ->setName('cc') - ->setValue($handles) + ->setValue($v_cc) ->setUser($user) ->setDatasource(new PhabricatorMetaMTAMailableDatasource())) ->appendChild( diff --git a/src/applications/pholio/query/PholioMockSearchEngine.php b/src/applications/pholio/query/PholioMockSearchEngine.php index 478e2cc219..91bc61f323 100644 --- a/src/applications/pholio/query/PholioMockSearchEngine.php +++ b/src/applications/pholio/query/PholioMockSearchEngine.php @@ -37,11 +37,7 @@ final class PholioMockSearchEngine extends PhabricatorApplicationSearchEngine { AphrontFormView $form, PhabricatorSavedQuery $saved_query) { - $phids = $saved_query->getParameter('authorPHIDs', array()); - $author_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); + $author_phids = $saved_query->getParameter('authorPHIDs', array()); $statuses = array( '' => pht('Any Status'), @@ -53,12 +49,12 @@ final class PholioMockSearchEngine extends PhabricatorApplicationSearchEngine { $status = head($status); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) - ->setValue($author_handles)) + ->setValue($author_phids)) ->appendChild( id(new AphrontFormSelectControl()) ->setLabel(pht('Status')) diff --git a/src/applications/phortune/controller/PhortuneAccountEditController.php b/src/applications/phortune/controller/PhortuneAccountEditController.php index b7632426c0..6d0f86d868 100644 --- a/src/applications/phortune/controller/PhortuneAccountEditController.php +++ b/src/applications/phortune/controller/PhortuneAccountEditController.php @@ -97,8 +97,6 @@ final class PhortuneAccountEditController extends PhortuneController { $submit_button = pht('Save Changes'); } - $member_handles = $this->loadViewerHandles($v_members); - $form = id(new AphrontFormView()) ->setUser($viewer) ->appendChild( @@ -107,12 +105,12 @@ final class PhortuneAccountEditController extends PhortuneController { ->setLabel(pht('Name')) ->setValue($v_name) ->setError($e_name)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setLabel(pht('Members')) ->setName('memberPHIDs') - ->setValue($member_handles) + ->setValue($v_members) ->setError($e_members)) ->appendChild( id(new AphrontFormSubmitControl()) diff --git a/src/applications/phortune/controller/PhortuneMerchantEditController.php b/src/applications/phortune/controller/PhortuneMerchantEditController.php index 2b66209761..6dfef5bd74 100644 --- a/src/applications/phortune/controller/PhortuneMerchantEditController.php +++ b/src/applications/phortune/controller/PhortuneMerchantEditController.php @@ -119,8 +119,6 @@ final class PhortuneMerchantEditController ->setObject($merchant) ->execute(); - $member_handles = $this->loadViewerHandles($v_members); - $form = id(new AphrontFormView()) ->setUser($viewer) ->appendChild( @@ -135,12 +133,12 @@ final class PhortuneMerchantEditController ->setName('desc') ->setLabel(pht('Description')) ->setValue($v_desc)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setLabel(pht('Members')) ->setName('memberPHIDs') - ->setValue($member_handles) + ->setValue($v_members) ->setError($e_members)) ->appendChild( id(new AphrontFormPolicyControl()) diff --git a/src/applications/phrequent/query/PhrequentSearchEngine.php b/src/applications/phrequent/query/PhrequentSearchEngine.php index b5737c945c..4b520ab36b 100644 --- a/src/applications/phrequent/query/PhrequentSearchEngine.php +++ b/src/applications/phrequent/query/PhrequentSearchEngine.php @@ -60,19 +60,13 @@ final class PhrequentSearchEngine extends PhabricatorApplicationSearchEngine { $order = $saved_query->getParameter( 'order', PhrequentUserTimeQuery::ORDER_ENDED_DESC); - $phids = array_merge($user_phids); - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); - $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('users') ->setLabel(pht('Users')) - ->setValue($handles)) + ->setValue($user_phids)) ->appendChild( id(new AphrontFormSelectControl()) ->setLabel(pht('Ended')) diff --git a/src/applications/ponder/controller/PonderQuestionEditController.php b/src/applications/ponder/controller/PonderQuestionEditController.php index 117eefa461..331c605eae 100644 --- a/src/applications/ponder/controller/PonderQuestionEditController.php +++ b/src/applications/ponder/controller/PonderQuestionEditController.php @@ -105,17 +105,11 @@ final class PonderQuestionEditController extends PonderController { ->setLabel(pht('Description')) ->setUser($user)); - if ($v_projects) { - $project_handles = $this->loadViewerHandles($v_projects); - } else { - $project_handles = array(); - } - - $form->appendChild( + $form->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Projects')) ->setName('projects') - ->setValue($project_handles) + ->setValue($v_projects) ->setDatasource(new PhabricatorProjectDatasource())); $form ->appendChild( diff --git a/src/applications/ponder/query/PonderQuestionSearchEngine.php b/src/applications/ponder/query/PonderQuestionSearchEngine.php index 462046544c..823b6aaf3c 100644 --- a/src/applications/ponder/query/PonderQuestionSearchEngine.php +++ b/src/applications/ponder/query/PonderQuestionSearchEngine.php @@ -64,25 +64,19 @@ final class PonderQuestionSearchEngine $status = $saved_query->getParameter( 'status', PonderQuestionStatus::STATUS_OPEN); - $phids = array_merge($author_phids, $answerer_phids); - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); - $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) - ->setValue(array_select_keys($handles, $author_phids))) - ->appendChild( + ->setValue($author_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('answerers') ->setLabel(pht('Answered By')) - ->setValue(array_select_keys($handles, $answerer_phids))) + ->setValue($answerer_phids)) ->appendChild( id(new AphrontFormSelectControl()) ->setLabel(pht('Status')) diff --git a/src/applications/project/controller/PhabricatorProjectBoardImportController.php b/src/applications/project/controller/PhabricatorProjectBoardImportController.php index 4861582a20..b11d6efe31 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardImportController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardImportController.php @@ -74,6 +74,7 @@ final class PhabricatorProjectBoardImportController ->setDatasource(id(new PhabricatorProjectDatasource()) ->setParameters(array('mustHaveColumns' => true)) ->setLimit(1)); + return $this->newDialog() ->setTitle(pht('Import Columns')) ->setWidth(AphrontDialogView::WIDTH_FORM) diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php index 26c0ed3709..750df2b77d 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php @@ -88,7 +88,7 @@ final class PhabricatorProjectMembersEditController $form = new AphrontFormView(); $form ->setUser($user) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setName('phids') ->setLabel(pht('Add Members')) diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php index 0297e910e5..ff2b1c790f 100644 --- a/src/applications/project/query/PhabricatorProjectSearchEngine.php +++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php @@ -77,11 +77,7 @@ final class PhabricatorProjectSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved) { - $phids = $saved->getParameter('memberPHIDs', array()); - $member_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); + $member_phids = $saved->getParameter('memberPHIDs', array()); $status = $saved->getParameter('status'); $name_match = $saved->getParameter('name'); @@ -123,12 +119,12 @@ final class PhabricatorProjectSearchEngine ->setName('name') ->setLabel(pht('Name')) ->setValue($name_match)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('members') ->setLabel(pht('Members')) - ->setValue($member_handles)) + ->setValue($member_phids)) ->appendChild( id(new AphrontFormSelectControl()) ->setLabel(pht('Status')) diff --git a/src/applications/releeph/controller/product/ReleephProductEditController.php b/src/applications/releeph/controller/product/ReleephProductEditController.php index 2399548206..926f813db0 100644 --- a/src/applications/releeph/controller/product/ReleephProductEditController.php +++ b/src/applications/releeph/controller/product/ReleephProductEditController.php @@ -120,13 +120,6 @@ final class ReleephProductEditController extends ReleephProductController { 'pushers', $product->getDetail('pushers', array())); - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($request->getUser()) - ->withPHIDs($pusher_phids) - ->execute(); - - $pusher_handles = array_select_keys($handles, $pusher_phids); - $form = id(new AphrontFormView()) ->setUser($request->getUser()) ->appendChild( @@ -191,12 +184,12 @@ final class ReleephProductEditController extends ReleephProductController { ->addStatic('projectName', $product->getName()); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Pushers')) ->setName('pushers') ->setDatasource(new PhabricatorPeopleDatasource()) - ->setValue($pusher_handles)) + ->setValue($pusher_phids)) ->appendChild($branch_template_input) ->appendChild($branch_template_preview) ->appendRemarkupInstructions($this->getBranchHelpText()); diff --git a/src/applications/releeph/query/ReleephRequestSearchEngine.php b/src/applications/releeph/query/ReleephRequestSearchEngine.php index 5f2626614b..07e5b06dfb 100644 --- a/src/applications/releeph/query/ReleephRequestSearchEngine.php +++ b/src/applications/releeph/query/ReleephRequestSearchEngine.php @@ -67,11 +67,7 @@ final class ReleephRequestSearchEngine AphrontFormView $form, PhabricatorSavedQuery $saved_query) { - $phids = $saved_query->getParameter('requestorPHIDs', array()); - $requestor_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); + $requestor_phids = $saved_query->getParameter('requestorPHIDs', array()); $form ->appendChild( @@ -86,12 +82,12 @@ final class ReleephRequestSearchEngine ->setLabel(pht('Severity')) ->setValue($saved_query->getParameter('severity')) ->setOptions($this->getSeverityOptions())) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('requestors') ->setLabel(pht('Requestors')) - ->setValue($requestor_handles)); + ->setValue($requestor_phids)); } protected function getURI($path) { diff --git a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php index 04f50a620b..b3928b94ef 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php @@ -59,10 +59,7 @@ final class PhabricatorRepositoryArcanistProjectEditController } if ($project->getSymbolIndexProjects()) { - $uses = id(new PhabricatorHandleQuery()) - ->setViewer($user) - ->withPHIDs($project->getSymbolIndexProjects()) - ->execute(); + $uses = $project->getSymbolIndexProjects(); } else { $uses = array(); } @@ -91,7 +88,7 @@ final class PhabricatorRepositoryArcanistProjectEditController 'Separate with commas, for example: %s', phutil_tag('tt', array(), 'php, py'))) ->setValue($langs)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Uses Symbols From')) ->setName('symbolIndexProjects') diff --git a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php index 25cb871cfc..85cf0938cb 100644 --- a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php +++ b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php @@ -55,35 +55,19 @@ final class PhabricatorRepositoryPushLogSearchEngine $repository_phids = $saved_query->getParameter('repositoryPHIDs', array()); $pusher_phids = $saved_query->getParameter('pusherPHIDs', array()); - $all_phids = array_merge( - $repository_phids, - $pusher_phids); - - if ($all_phids) { - $handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($all_phids) - ->execute(); - } else { - $handles = array(); - } - - $repository_handles = array_select_keys($handles, $repository_phids); - $pusher_handles = array_select_keys($handles, $pusher_phids); - $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new DiffusionRepositoryDatasource()) ->setName('repositories') ->setLabel(pht('Repositories')) - ->setValue($repository_handles)) - ->appendChild( + ->setValue($repository_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('pushers') ->setLabel(pht('Pushers')) - ->setValue($pusher_handles)); + ->setValue($pusher_phids)); } protected function getURI($path) { diff --git a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php index fe7736fea2..103f07c87f 100644 --- a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php +++ b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php @@ -84,15 +84,6 @@ final class PhabricatorRepositorySearchEngine $name = $saved_query->getParameter('name'); $any_project_phids = $saved_query->getParameter('anyProjectPHIDs', array()); - if ($any_project_phids) { - $any_project_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($any_project_phids) - ->execute(); - } else { - $any_project_handles = array(); - } - $form ->appendChild( id(new AphrontFormTextControl()) @@ -104,12 +95,12 @@ final class PhabricatorRepositorySearchEngine ->setName('name') ->setLabel(pht('Name Contains')) ->setValue($name)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorProjectDatasource()) ->setName('anyProjects') ->setLabel(pht('In Any Project')) - ->setValue($any_project_handles)) + ->setValue($any_project_phids)) ->appendChild( id(new AphrontFormSelectControl()) ->setName('status') diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php index 0e13f9ffea..3a8f822c8a 100644 --- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php +++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php @@ -66,22 +66,6 @@ final class PhabricatorSearchApplicationSearchEngine $subscriber_phids = $saved->getParameter('subscriberPHIDs', array()); $project_phids = $saved->getParameter('projectPHIDs', array()); - $all_phids = array_merge( - $author_phids, - $owner_phids, - $subscriber_phids, - $project_phids); - - $all_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($all_phids) - ->execute(); - - $author_handles = array_select_keys($all_handles, $author_phids); - $owner_handles = array_select_keys($all_handles, $owner_phids); - $subscriber_handles = array_select_keys($all_handles, $subscriber_phids); - $project_handles = array_select_keys($all_handles, $project_phids); - $with_unowned = $saved->getParameter('withUnowned', array()); $status_values = $saved->getParameter('statuses', array()); @@ -132,18 +116,18 @@ final class PhabricatorSearchApplicationSearchEngine ->setValue($saved->getParameter('query'))) ->appendChild($status_control) ->appendChild($types_control) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setName('authorPHIDs') ->setLabel('Authors') ->setDatasource(new PhabricatorPeopleDatasource()) - ->setValue($author_handles)) - ->appendChild( + ->setValue($author_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setName('ownerPHIDs') ->setLabel('Owners') ->setDatasource(new PhabricatorTypeaheadOwnerDatasource()) - ->setValue($owner_handles)) + ->setValue($owner_phids)) ->appendChild( id(new AphrontFormCheckboxControl()) ->addCheckbox( @@ -151,18 +135,18 @@ final class PhabricatorSearchApplicationSearchEngine 1, pht('Show only unowned documents.'), $with_unowned)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setName('subscriberPHIDs') ->setLabel('Subscribers') ->setDatasource(new PhabricatorPeopleDatasource()) - ->setValue($subscriber_handles)) - ->appendChild( + ->setValue($subscriber_phids)) + ->appendControl( id(new AphrontFormTokenizerControl()) ->setName('projectPHIDs') ->setLabel('In Any Project') ->setDatasource(new PhabricatorProjectDatasource()) - ->setValue($project_handles)); + ->setValue($project_phids)); } protected function getURI($path) { diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php index d84b255086..7374ea6468 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvoteEditController.php @@ -145,12 +145,6 @@ final class PhabricatorSlowvoteEditController pht('Resolve issues and build consensus through '. 'protracted deliberation.')); - if ($v_projects) { - $project_handles = $this->loadViewerHandles($v_projects); - } else { - $project_handles = array(); - } - $form = id(new AphrontFormView()) ->setUser($user) ->appendChild($instructions) @@ -167,11 +161,11 @@ final class PhabricatorSlowvoteEditController ->setLabel(pht('Description')) ->setName('description') ->setValue($v_description)) - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setLabel(pht('Projects')) ->setName('projects') - ->setValue($project_handles) + ->setValue($v_projects) ->setDatasource(new PhabricatorProjectDatasource())); if ($is_new) { diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php index 33520978a1..fdbd951222 100644 --- a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php +++ b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php @@ -47,22 +47,18 @@ final class PhabricatorSlowvoteSearchEngine public function buildSearchForm( AphrontFormView $form, PhabricatorSavedQuery $saved_query) { - $phids = $saved_query->getParameter('authorPHIDs', array()); - $author_handles = id(new PhabricatorHandleQuery()) - ->setViewer($this->requireViewer()) - ->withPHIDs($phids) - ->execute(); + $author_phids = $saved_query->getParameter('authorPHIDs', array()); $voted = $saved_query->getParameter('voted', false); $statuses = $saved_query->getParameter('statuses', array()); $form - ->appendChild( + ->appendControl( id(new AphrontFormTokenizerControl()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setName('authors') ->setLabel(pht('Authors')) - ->setValue($author_handles)) + ->setValue($author_phids)) ->appendChild( id(new AphrontFormCheckboxControl()) ->addCheckbox( diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php index 440ac7dab7..7ea66a8a68 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php @@ -9,18 +9,14 @@ final class PhabricatorStandardCustomFieldUsers public function renderEditControl(array $handles) { $value = $this->getFieldValue(); - if ($value) { - $control_value = array_select_keys($handles, $value); - } else { - $control_value = array(); - } $control = id(new AphrontFormTokenizerControl()) + ->setUser($this->getViewer()) ->setLabel($this->getFieldName()) ->setName($this->getFieldKey()) ->setDatasource(new PhabricatorPeopleDatasource()) ->setCaption($this->getCaption()) - ->setValue($control_value); + ->setValue(nonempty($value, array())); $limit = $this->getFieldConfigValue('limit'); if ($limit) { @@ -40,9 +36,9 @@ final class PhabricatorStandardCustomFieldUsers ->setLabel($this->getFieldName()) ->setName($this->getFieldKey()) ->setDatasource(new PhabricatorPeopleDatasource()) - ->setValue($handles); + ->setValue(nonempty($value, array())); - $form->appendChild($control); + $form->appendControl($control); } public function getHeraldFieldValueType($condition) { diff --git a/src/view/form/AphrontFormView.php b/src/view/form/AphrontFormView.php index f680800f59..ada943d532 100644 --- a/src/view/form/AphrontFormView.php +++ b/src/view/form/AphrontFormView.php @@ -13,6 +13,7 @@ final class AphrontFormView extends AphrontView { private $sigils = array(); private $metadata; private $controls = array(); + private $fullWidth = false; public function setMetadata($metadata) { $this->metadata = $metadata; @@ -63,6 +64,15 @@ final class AphrontFormView extends AphrontView { return $this; } + public function setFullWidth($full_width) { + $this->fullWidth = $full_width; + return $this; + } + + public function getFullWidth() { + return $this->fullWidth; + } + public function appendInstructions($text) { return $this->appendChild( phutil_tag( @@ -83,6 +93,7 @@ final class AphrontFormView extends AphrontView { public function buildLayoutView() { return id(new PHUIFormLayoutView()) + ->setFullWidth($this->getFullWidth()) ->appendChild($this->renderDataInputs()) ->appendChild($this->renderChildren()); }