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:
@@ -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,
|
||||
),
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user