1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 02:32:42 +01:00

Respect tokenizer limits in the bulk editor

Summary: Ref T13025. This makes limits (for fields like "Assign To") work in the bulk editor, so you can't type "Assign to: x, y, z" anymore.

Test Plan: Hit limit for "Assign to" and a custom project field. No limit for "Add subscribers".

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13025

Differential Revision: https://secure.phabricator.com/D18888
This commit is contained in:
epriestley 2018-01-19 14:50:42 -08:00
parent fbfcc37531
commit d9b6513a21
3 changed files with 10 additions and 2 deletions

View file

@ -23,7 +23,6 @@ final class BulkTokenizerParameterType
$template_markup = $template->render(); $template_markup = $template->render();
$datasource = $this->getDatasource(); $datasource = $this->getDatasource();
$limit = null;
return array( return array(
'markup' => (string)hsprintf('%s', $template_markup), 'markup' => (string)hsprintf('%s', $template_markup),
@ -31,7 +30,7 @@ final class BulkTokenizerParameterType
'src' => $datasource->getDatasourceURI(), 'src' => $datasource->getDatasourceURI(),
'browseURI' => $datasource->getBrowseURI(), 'browseURI' => $datasource->getBrowseURI(),
'placeholder' => $datasource->getPlaceholderText(), 'placeholder' => $datasource->getPlaceholderText(),
'limit' => $limit, 'limit' => $datasource->getLimit(),
), ),
'value' => null, 'value' => null,
); );

View file

@ -60,6 +60,10 @@ abstract class PhabricatorTokenizerEditField
$datasource = $this->newDatasource() $datasource = $this->newDatasource()
->setViewer($this->getViewer()); ->setViewer($this->getViewer());
if ($this->getIsSingleValue()) {
$datasource->setLimit(1);
}
return id(new BulkTokenizerParameterType()) return id(new BulkTokenizerParameterType())
->setDatasource($datasource); ->setDatasource($datasource);
} }

View file

@ -68,6 +68,11 @@ abstract class PhabricatorStandardCustomFieldTokenizer
protected function newBulkParameterType() { protected function newBulkParameterType() {
$datasource = $this->getDatasource(); $datasource = $this->getDatasource();
$limit = $this->getFieldConfigValue('limit');
if ($limit) {
$datasource->setLimit($limit);
}
return id(new BulkTokenizerParameterType()) return id(new BulkTokenizerParameterType())
->setDatasource($datasource); ->setDatasource($datasource);
} }