Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14061811
D12456.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D12456.diff
View Options
diff --git a/src/applications/differential/view/DifferentialAddCommentView.php b/src/applications/differential/view/DifferentialAddCommentView.php
--- a/src/applications/differential/view/DifferentialAddCommentView.php
+++ b/src/applications/differential/view/DifferentialAddCommentView.php
@@ -67,6 +67,9 @@
'resign' => pht('Suggest Reviewers'),
);
+ $mailable_source = new PhabricatorMetaMTAMailableDatasource();
+ $reviewer_source = new PhabricatorProjectOrUserDatasource();
+
$form = new AphrontFormView();
$form
->setWorkflow(true)
@@ -88,7 +91,8 @@
->setControlID('add-reviewers')
->setControlStyle($enable_reviewers ? null : 'display: none')
->setID('add-reviewers-tokenizer')
- ->setDisableBehavior(true))
+ ->setDisableBehavior(true)
+ ->setDatasource($reviewer_source))
->appendControl(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Add Subscribers'))
@@ -96,7 +100,8 @@
->setControlID('add-ccs')
->setControlStyle($enable_ccs ? null : 'display: none')
->setID('add-ccs-tokenizer')
- ->setDisableBehavior(true))
+ ->setDisableBehavior(true)
+ ->setDatasource($mailable_source))
->appendChild(
id(new PhabricatorRemarkupControl())
->setName('comment')
@@ -108,9 +113,6 @@
id(new AphrontFormSubmitControl())
->setValue(pht('Submit')));
- $mailable_source = new PhabricatorMetaMTAMailableDatasource();
- $reviewer_source = new PhabricatorProjectOrUserDatasource();
-
Javelin::initBehavior(
'differential-add-reviewers-and-ccs',
array(
diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php
--- a/src/applications/diffusion/controller/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitController.php
@@ -677,6 +677,9 @@
$actions = $this->getAuditActions($commit, $audit_requests);
+ $mailable_source = new PhabricatorMetaMTAMailableDatasource();
+ $auditor_source = new DiffusionAuditorDatasource();
+
$form = id(new AphrontFormView())
->setUser($user)
->setAction('/audit/addcomment/')
@@ -694,7 +697,8 @@
->setControlID('add-auditors')
->setControlStyle('display: none')
->setID('add-auditors-tokenizer')
- ->setDisableBehavior(true))
+ ->setDisableBehavior(true)
+ ->setDatasource($auditor_source))
->appendControl(
id(new AphrontFormTokenizerControl())
->setLabel(pht('Add CCs'))
@@ -702,7 +706,8 @@
->setControlID('add-ccs')
->setControlStyle('display: none')
->setID('add-ccs-tokenizer')
- ->setDisableBehavior(true))
+ ->setDisableBehavior(true)
+ ->setDatasource($mailable_source))
->appendChild(
id(new PhabricatorRemarkupControl())
->setLabel(pht('Comments'))
@@ -718,9 +723,6 @@
$header->setHeader(
$is_serious ? pht('Audit Commit') : pht('Creative Accounting'));
- $mailable_source = new PhabricatorMetaMTAMailableDatasource();
- $auditor_source = new DiffusionAuditorDatasource();
-
Javelin::initBehavior(
'differential-add-reviewers-and-ccs',
array(
diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -182,6 +182,10 @@
$draft_text = null;
}
+ $projects_source = new PhabricatorProjectDatasource();
+ $users_source = new PhabricatorPeopleDatasource();
+ $mailable_source = new PhabricatorMetaMTAMailableDatasource();
+
$comment_form = new AphrontFormView();
$comment_form
->setUser($user)
@@ -209,7 +213,8 @@
->setControlID('assign_to')
->setControlStyle('display: none')
->setID('assign-tokenizer')
- ->setDisableBehavior(true))
+ ->setDisableBehavior(true)
+ ->setDatasource($users_source))
->appendControl(
id(new AphrontFormTokenizerControl())
->setLabel(pht('CCs'))
@@ -217,7 +222,8 @@
->setControlID('ccs')
->setControlStyle('display: none')
->setID('cc-tokenizer')
- ->setDisableBehavior(true))
+ ->setDisableBehavior(true)
+ ->setDatasource($mailable_source))
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Priority'))
@@ -233,7 +239,8 @@
->setControlID('projects')
->setControlStyle('display: none')
->setID('projects-tokenizer')
- ->setDisableBehavior(true))
+ ->setDisableBehavior(true)
+ ->setDatasource($projects_source))
->appendChild(
id(new AphrontFormFileControl())
->setLabel(pht('File'))
@@ -260,10 +267,6 @@
PhabricatorTransactions::TYPE_EDGE => 'projects',
);
- $projects_source = new PhabricatorProjectDatasource();
- $users_source = new PhabricatorPeopleDatasource();
- $mailable_source = new PhabricatorMetaMTAMailableDatasource();
-
$tokenizer_map = array(
PhabricatorTransactions::TYPE_EDGE => array(
'id' => 'projects-tokenizer',
diff --git a/src/view/form/control/AphrontFormTokenizerControl.php b/src/view/form/control/AphrontFormTokenizerControl.php
--- a/src/view/form/control/AphrontFormTokenizerControl.php
+++ b/src/view/form/control/AphrontFormTokenizerControl.php
@@ -51,17 +51,15 @@
}
$datasource = $this->datasource;
- if ($datasource) {
- $datasource->setViewer($this->getUser());
+ if (!$datasource) {
+ throw new Exception(
+ pht('You must set a datasource to use a TokenizerControl.'));
}
+ $datasource->setViewer($this->getUser());
$placeholder = null;
if (!strlen($this->placeholder)) {
- if ($datasource) {
- $placeholder = $datasource->getPlaceholderText();
- }
- } else {
- $placeholder = $this->placeholder;
+ $placeholder = $datasource->getPlaceholderText();
}
$tokens = array();
@@ -71,14 +69,13 @@
$token = PhabricatorTypeaheadTokenView::newFromHandle($handles[$value]);
} else {
$token = null;
- if ($datasource) {
- $function = $datasource->parseFunction($value);
- if ($function) {
- $token_list = $datasource->renderFunctionTokens(
- $function['name'],
- array($function['argv']));
- $token = head($token_list);
- }
+
+ $function = $datasource->parseFunction($value);
+ if ($function) {
+ $token_list = $datasource->renderFunctionTokens(
+ $function['name'],
+ array($function['argv']));
+ $token = head($token_list);
}
if (!$token) {
@@ -105,17 +102,10 @@
$username = $this->user->getUsername();
}
- $datasource_uri = null;
- $browse_uri = null;
- if ($datasource) {
- $datasource->setViewer($this->getUser());
-
- $datasource_uri = $datasource->getDatasourceURI();
-
- $browse_uri = $datasource->getBrowseURI();
- if ($browse_uri) {
- $template->setBrowseURI($browse_uri);
- }
+ $datasource_uri = $datasource->getDatasourceURI();
+ $browse_uri = $datasource->getBrowseURI();
+ if ($browse_uri) {
+ $template->setBrowseURI($browse_uri);
}
if (!$this->disableBehavior) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 8:40 AM (1 h, 2 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6739522
Default Alt Text
D12456.diff (7 KB)
Attached To
Mode
D12456: Require TokenizerControl to always have a datasource
Attached
Detach File
Event Timeline
Log In to Comment