Skip to content

Commit d403700

Browse files
author
epriestley
committed
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
1 parent 7711ea9 commit d403700

File tree

59 files changed

+261
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+261
-560
lines changed

resources/celerity/map.php

+21-21
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
return array(
99
'names' => array(
10-
'core.pkg.css' => '20d3b672',
10+
'core.pkg.css' => 'ad650d52',
1111
'core.pkg.js' => '0c88e7f6',
1212
'darkconsole.pkg.js' => '8ab24e01',
1313
'differential.pkg.css' => '3500921f',
@@ -20,7 +20,7 @@
2020
'rsrc/css/aphront/dark-console.css' => '6378ef3d',
2121
'rsrc/css/aphront/dialog-view.css' => 'd2e76b88',
2222
'rsrc/css/aphront/lightbox-attachment.css' => '7acac05d',
23-
'rsrc/css/aphront/list-filter-view.css' => '2ae43867',
23+
'rsrc/css/aphront/list-filter-view.css' => '18b7e144',
2424
'rsrc/css/aphront/multi-column.css' => 'fd18389d',
2525
'rsrc/css/aphront/notification.css' => '9c279160',
2626
'rsrc/css/aphront/pager-view.css' => '2e3539af',
@@ -34,7 +34,7 @@
3434
'rsrc/css/aphront/typeahead.css' => '0e403212',
3535
'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af',
3636
'rsrc/css/application/auth/auth.css' => '1e655982',
37-
'rsrc/css/application/base/main-menu-view.css' => 'cfa2ec0f',
37+
'rsrc/css/application/base/main-menu-view.css' => '361a51f9',
3838
'rsrc/css/application/base/notification-menu.css' => '6aa0a74b',
3939
'rsrc/css/application/base/phabricator-application-launch-view.css' => '16ca323f',
4040
'rsrc/css/application/base/standard-page-view.css' => 'd2a6518d',
@@ -45,7 +45,7 @@
4545
'rsrc/css/application/config/setup-issue.css' => '22270af2',
4646
'rsrc/css/application/config/unhandled-exception.css' => '37d4f9a2',
4747
'rsrc/css/application/conpherence/durable-column.css' => 'caa12d4a',
48-
'rsrc/css/application/conpherence/menu.css' => 'beef0920',
48+
'rsrc/css/application/conpherence/menu.css' => '7c900089',
4949
'rsrc/css/application/conpherence/message-pane.css' => '44154798',
5050
'rsrc/css/application/conpherence/notification.css' => '04a6e10a',
5151
'rsrc/css/application/conpherence/update.css' => '1099a660',
@@ -355,7 +355,7 @@
355355
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
356356
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => 'bb928342',
357357
'rsrc/js/application/conpherence/behavior-durable-column.js' => 'a0216452',
358-
'rsrc/js/application/conpherence/behavior-menu.js' => 'de5579b4',
358+
'rsrc/js/application/conpherence/behavior-menu.js' => 'cda6de80',
359359
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
360360
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
361361
'rsrc/js/application/conpherence/behavior-widget-pane.js' => '1ec93bcf',
@@ -501,7 +501,7 @@
501501
'aphront-bars' => '231ac33c',
502502
'aphront-dark-console-css' => '6378ef3d',
503503
'aphront-dialog-view-css' => 'd2e76b88',
504-
'aphront-list-filter-view-css' => '2ae43867',
504+
'aphront-list-filter-view-css' => '18b7e144',
505505
'aphront-multi-column-view-css' => 'fd18389d',
506506
'aphront-pager-view-css' => '2e3539af',
507507
'aphront-panel-view-css' => '8427b78d',
@@ -515,7 +515,7 @@
515515
'config-options-css' => '7fedf08b',
516516
'config-welcome-css' => '6abd79be',
517517
'conpherence-durable-column-view' => 'caa12d4a',
518-
'conpherence-menu-css' => 'beef0920',
518+
'conpherence-menu-css' => '7c900089',
519519
'conpherence-message-pane-css' => '44154798',
520520
'conpherence-notification-css' => '04a6e10a',
521521
'conpherence-thread-manager' => 'bb928342',
@@ -557,7 +557,7 @@
557557
'javelin-behavior-boards-dropdown' => '0ec56e1d',
558558
'javelin-behavior-choose-control' => '6153c708',
559559
'javelin-behavior-config-reorder-fields' => '14a827de',
560-
'javelin-behavior-conpherence-menu' => 'de5579b4',
560+
'javelin-behavior-conpherence-menu' => 'cda6de80',
561561
'javelin-behavior-conpherence-pontificate' => '21ba5861',
562562
'javelin-behavior-conpherence-widget-pane' => '1ec93bcf',
563563
'javelin-behavior-countdown-timer' => 'e4cc26b3',
@@ -729,7 +729,7 @@
729729
'phabricator-hovercard-view-css' => '893f4783',
730730
'phabricator-keyboard-shortcut' => '1ae869f2',
731731
'phabricator-keyboard-shortcut-manager' => 'c1700f6f',
732-
'phabricator-main-menu-view' => 'cfa2ec0f',
732+
'phabricator-main-menu-view' => '361a51f9',
733733
'phabricator-nav-view-css' => '7aeaf435',
734734
'phabricator-notification' => '0c6946e7',
735735
'phabricator-notification-css' => '9c279160',
@@ -1755,6 +1755,18 @@
17551755
'javelin-stratcom',
17561756
'phabricator-phtize',
17571757
),
1758+
'cda6de80' => array(
1759+
'javelin-behavior',
1760+
'javelin-dom',
1761+
'javelin-util',
1762+
'javelin-stratcom',
1763+
'javelin-workflow',
1764+
'javelin-behavior-device',
1765+
'javelin-history',
1766+
'javelin-vector',
1767+
'phabricator-shaped-request',
1768+
'conpherence-thread-manager',
1769+
),
17581770
'd19198c8' => array(
17591771
'javelin-install',
17601772
'javelin-dom',
@@ -1807,18 +1819,6 @@
18071819
'javelin-typeahead-ondemand-source',
18081820
'javelin-dom',
18091821
),
1810-
'de5579b4' => array(
1811-
'javelin-behavior',
1812-
'javelin-dom',
1813-
'javelin-util',
1814-
'javelin-stratcom',
1815-
'javelin-workflow',
1816-
'javelin-behavior-device',
1817-
'javelin-history',
1818-
'javelin-vector',
1819-
'phabricator-shaped-request',
1820-
'conpherence-thread-manager',
1821-
),
18221822
'e10f8e18' => array(
18231823
'javelin-behavior',
18241824
'javelin-dom',

src/applications/conpherence/controller/ConpherenceNewController.php

+9-25
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,9 @@ public function handleRequest(AphrontRequest $request) {
5353
}
5454
}
5555

56-
57-
$participant_handles = array();
58-
if ($participants) {
59-
$participant_handles = id(new PhabricatorHandleQuery())
60-
->setViewer($user)
61-
->withPHIDs($participants)
62-
->execute();
63-
}
64-
6556
$submit_uri = $this->getApplicationURI('new/');
6657
$cancel_uri = $this->getApplicationURI();
6758

68-
// TODO - we can get a better cancel_uri once we get better at crazy
69-
// ajax jonx T2086
70-
if ($participant_prefill) {
71-
$handle = $participant_handles[$participant_prefill];
72-
$cancel_uri = $handle->getURI();
73-
}
74-
7559
$dialog = id(new AphrontDialogView())
7660
->setWidth(AphrontDialogView::WIDTH_FORM)
7761
->setErrors($errors)
@@ -80,17 +64,17 @@ public function handleRequest(AphrontRequest $request) {
8064
->addCancelButton($cancel_uri)
8165
->addSubmitButton(pht('Send Message'));
8266

83-
$form = id(new PHUIFormLayoutView())
67+
$form = id(new AphrontFormView())
8468
->setUser($user)
8569
->setFullWidth(true)
86-
->appendChild(
70+
->appendControl(
8771
id(new AphrontFormTokenizerControl())
88-
->setName('participants')
89-
->setValue($participant_handles)
90-
->setUser($user)
91-
->setDatasource(new PhabricatorPeopleDatasource())
92-
->setLabel(pht('To'))
93-
->setError($e_participants))
72+
->setName('participants')
73+
->setValue($participants)
74+
->setUser($user)
75+
->setDatasource(new PhabricatorPeopleDatasource())
76+
->setLabel(pht('To'))
77+
->setError($e_participants))
9478
->appendChild(
9579
id(new PhabricatorRemarkupControl())
9680
->setUser($user)
@@ -99,7 +83,7 @@ public function handleRequest(AphrontRequest $request) {
9983
->setLabel(pht('Message'))
10084
->setError($e_message));
10185

102-
$dialog->appendChild($form);
86+
$dialog->appendForm($form);
10387

10488
return id(new AphrontDialogResponse())->setDialog($dialog);
10589
}

src/applications/conpherence/controller/ConpherenceUpdateController.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,14 @@ private function renderAddPersonDialogue(
225225
$user = $request->getUser();
226226
$add_person = $request->getStr('add_person');
227227

228-
$form = id(new PHUIFormLayoutView())
228+
$form = id(new AphrontFormView())
229229
->setUser($user)
230230
->setFullWidth(true)
231-
->appendChild(
231+
->appendControl(
232232
id(new AphrontFormTokenizerControl())
233-
->setName('add_person')
234-
->setUser($user)
235-
->setDatasource(new PhabricatorPeopleDatasource()));
233+
->setName('add_person')
234+
->setUser($user)
235+
->setDatasource(new PhabricatorPeopleDatasource()));
236236

237237
require_celerity_resource('conpherence-update-css');
238238
$view = id(new AphrontDialogView())
@@ -241,7 +241,7 @@ private function renderAddPersonDialogue(
241241
->addHiddenInput(
242242
'latest_transaction_id',
243243
$request->getInt('latest_transaction_id'))
244-
->appendChild($form);
244+
->appendForm($form);
245245

246246
if ($request->getExists('minimal_display')) {
247247
$view->addHiddenInput('minimal_display', true);

src/applications/conpherence/query/ConpherenceThreadSearchEngine.php

+7-10
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,15 @@ public function buildSearchForm(
5252
AphrontFormView $form,
5353
PhabricatorSavedQuery $saved) {
5454

55-
$phids = $saved->getParameter('participantPHIDs', array());
56-
$participant_handles = id(new PhabricatorHandleQuery())
57-
->setViewer($this->requireViewer())
58-
->withPHIDs($phids)
59-
->execute();
55+
$participant_phids = $saved->getParameter('participantPHIDs', array());
56+
6057
$form
61-
->appendChild(
58+
->appendControl(
6259
id(new AphrontFormTokenizerControl())
63-
->setDatasource(new PhabricatorPeopleDatasource())
64-
->setName('participants')
65-
->setLabel(pht('Participants'))
66-
->setValue($participant_handles));
60+
->setDatasource(new PhabricatorPeopleDatasource())
61+
->setName('participants')
62+
->setLabel(pht('Participants'))
63+
->setValue($participant_phids));
6764
}
6865

6966
protected function getURI($path) {

src/applications/countdown/query/PhabricatorCountdownSearchEngine.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,17 @@ public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
4040
public function buildSearchForm(
4141
AphrontFormView $form,
4242
PhabricatorSavedQuery $saved_query) {
43-
$phids = $saved_query->getParameter('authorPHIDs', array());
44-
$author_handles = id(new PhabricatorHandleQuery())
45-
->setViewer($this->requireViewer())
46-
->withPHIDs($phids)
47-
->execute();
4843

44+
$author_phids = $saved_query->getParameter('authorPHIDs', array());
4945
$upcoming = $saved_query->getParameter('upcoming');
5046

5147
$form
52-
->appendChild(
48+
->appendControl(
5349
id(new AphrontFormTokenizerControl())
5450
->setDatasource(new PhabricatorPeopleDatasource())
5551
->setName('authors')
5652
->setLabel(pht('Authors'))
57-
->setValue($author_handles))
53+
->setValue($author_phids))
5854
->appendChild(
5955
id(new AphrontFormCheckboxControl())
6056
->addCheckbox(

src/applications/differential/controller/DifferentialDiffCreateController.php

+19-17
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public function handleRequest(AphrontRequest $request) {
2828
// This object is just for policy stuff
2929
$diff_object = DifferentialDiff::initializeNewDiff($viewer);
3030
$repository_phid = null;
31-
$repository_value = array();
3231
$errors = array();
3332
$e_diff = null;
3433
$e_file = null;
@@ -62,7 +61,8 @@ public function handleRequest(AphrontRequest $request) {
6261
array(
6362
'diff' => $diff,
6463
'repositoryPHID' => $repository_phid,
65-
'viewPolicy' => $request->getStr('viewPolicy'),));
64+
'viewPolicy' => $request->getStr('viewPolicy'),
65+
));
6666
$call->setUser($viewer);
6767
$result = $call->execute();
6868

@@ -93,10 +93,6 @@ public function handleRequest(AphrontRequest $request) {
9393

9494
$cancel_uri = $this->getApplicationURI();
9595

96-
if ($repository_phid) {
97-
$repository_value = $this->loadViewerHandles(array($repository_phid));
98-
}
99-
10096
$policies = id(new PhabricatorPolicyQuery())
10197
->setViewer($viewer)
10298
->setObject($diff_object)
@@ -148,6 +144,12 @@ public function handleRequest(AphrontRequest $request) {
148144
->setValue($revision_handle->renderLink()));
149145
}
150146

147+
if ($repository_phid) {
148+
$repository_value = array($repository_phid);
149+
} else {
150+
$repository_value = array();
151+
}
152+
151153
$form
152154
->appendChild(
153155
id(new AphrontFormTextAreaControl())
@@ -161,20 +163,20 @@ public function handleRequest(AphrontRequest $request) {
161163
->setLabel(pht('Raw Diff From File'))
162164
->setName('diff-file')
163165
->setError($e_file))
164-
->appendChild(
166+
->appendControl(
165167
id(new AphrontFormTokenizerControl())
166-
->setName(id(new DifferentialRepositoryField())->getFieldKey())
167-
->setLabel(pht('Repository'))
168-
->setDatasource(new DiffusionRepositoryDatasource())
169-
->setValue($repository_value)
170-
->setLimit(1))
168+
->setName(id(new DifferentialRepositoryField())->getFieldKey())
169+
->setLabel(pht('Repository'))
170+
->setDatasource(new DiffusionRepositoryDatasource())
171+
->setValue($repository_value)
172+
->setLimit(1))
171173
->appendChild(
172174
id(new AphrontFormPolicyControl())
173-
->setUser($viewer)
174-
->setName('viewPolicy')
175-
->setPolicyObject($diff_object)
176-
->setPolicies($policies)
177-
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
175+
->setUser($viewer)
176+
->setName('viewPolicy')
177+
->setPolicyObject($diff_object)
178+
->setPolicies($policies)
179+
->setCapability(PhabricatorPolicyCapability::CAN_VIEW))
178180
->appendChild(
179181
id(new AphrontFormSubmitControl())
180182
->addCancelButton($cancel_uri)

src/applications/differential/customfield/DifferentialProjectsField.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,12 @@ public function readValueFromRequest(AphrontRequest $request) {
4949
$this->setValue($request->getArr($this->getFieldKey()));
5050
}
5151

52-
public function getRequiredHandlePHIDsForEdit() {
53-
return $this->getValue();
54-
}
55-
5652
public function renderEditControl(array $handles) {
5753
return id(new AphrontFormTokenizerControl())
54+
->setUser($this->getViewer())
5855
->setName($this->getFieldKey())
5956
->setDatasource(new PhabricatorProjectDatasource())
60-
->setValue($handles)
57+
->setValue($this->getValue())
6158
->setLabel($this->getFieldName());
6259
}
6360

src/applications/differential/customfield/DifferentialRepositoryField.php

+4-11
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,18 @@ public function readValueFromRequest(AphrontRequest $request) {
3232
$this->setValue(nonempty($first, null));
3333
}
3434

35-
public function getRequiredHandlePHIDsForEdit() {
36-
$phids = array();
37-
if ($this->getValue()) {
38-
$phids[] = $this->getValue();
39-
}
40-
return $phids;
41-
}
42-
4335
public function renderEditControl(array $handles) {
4436
if ($this->getValue()) {
45-
$control_value = array_select_keys($handles, array($this->getValue()));
37+
$value = array($this->getValue());
4638
} else {
47-
$control_value = array();
39+
$value = array();
4840
}
4941

5042
return id(new AphrontFormTokenizerControl())
43+
->setUser($this->getViewer())
5144
->setName($this->getFieldKey())
5245
->setDatasource(new DiffusionRepositoryDatasource())
53-
->setValue($control_value)
46+
->setValue($value)
5447
->setError($this->getFieldError())
5548
->setLabel($this->getFieldName())
5649
->setLimit(1);

0 commit comments

Comments
 (0)