1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Set an explicit default value for the bulk action control

Summary:
Ref T13025. See <https://discourse.phabricator-community.org/t/bulk-edit-no-actions-available/1011/1>.

I'm not sure if this is what the user is seeing, but in Chrome, the `<select />` does not automatically get set to the first valid value like it does in Safari.

Set it to the first valid value explicitly.

Test Plan: In Chrome, bulk editor previously hit a JS error when trying to read a bad action off the `<select />`. After patch, bulk edits go through cleanly.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13025

Differential Revision: https://secure.phabricator.com/D18923
This commit is contained in:
epriestley 2018-01-24 15:26:13 -08:00
parent d28ddc21a5
commit 1059fae6c9

View file

@ -303,6 +303,7 @@ abstract class PhabricatorBulkEngine extends Phobject {
$spec = array();
$option_groups = igroup($edit_map, 'group');
$default_value = null;
foreach ($groups as $group_key => $group) {
$options = idx($option_groups, $group_key, array());
if (!$options) {
@ -315,6 +316,10 @@ abstract class PhabricatorBulkEngine extends Phobject {
'key' => $option['xaction'],
'label' => $option['label'],
);
if ($default_value === null) {
$default_value = $option['xaction'];
}
}
$spec[] = array(
@ -332,6 +337,7 @@ abstract class PhabricatorBulkEngine extends Phobject {
'inputNodeID' => $input_id,
'edits' => $edit_map,
'optgroups' => array(
'value' => $default_value,
'groups' => $spec,
),
));