From 7a0090f4d070e1e1ac4b512bdc808724be9ed9d4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 26 Sep 2019 11:44:51 -0700 Subject: [PATCH] Fix an issue where the "viewer" is not passed to Bulk Edit controls properly Summary: See PHI1442. If you have a bulk-editable datasource field with a composite datasource, it can currently fatal on the bulk edit workflow because the viewer is not passed correctly. The error looks something like this: > Argument 1 passed to PhabricatorDatasourceEngine::setViewer() must be an instance of PhabricatorUser, null given, called in /Users/epriestley/dev/core/lib/phabricator/src/applications/typeahead/datasource/PhabricatorTypeaheadCompositeDatasource.php on line 231 Test Plan: Configured a Maniphest custom field with a composite datasource, then tried a bulk edit. Things worked cleanly instead of fataling. Differential Revision: https://secure.phabricator.com/D20841 --- .../transactions/bulk/type/BulkTokenizerParameterType.php | 3 ++- .../transactions/editengine/PhabricatorEditEngine.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/applications/transactions/bulk/type/BulkTokenizerParameterType.php b/src/applications/transactions/bulk/type/BulkTokenizerParameterType.php index a48f8877d5..59682412fd 100644 --- a/src/applications/transactions/bulk/type/BulkTokenizerParameterType.php +++ b/src/applications/transactions/bulk/type/BulkTokenizerParameterType.php @@ -22,7 +22,8 @@ final class BulkTokenizerParameterType $template = new AphrontTokenizerTemplateView(); $template_markup = $template->render(); - $datasource = $this->getDatasource(); + $datasource = $this->getDatasource() + ->setViewer($this->getViewer()); return array( 'markup' => (string)hsprintf('%s', $template_markup), diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php index 0986247454..14143c733a 100644 --- a/src/applications/transactions/editengine/PhabricatorEditEngine.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php @@ -2523,6 +2523,8 @@ abstract class PhabricatorEditEngine } final public function newBulkEditMap() { + $viewer = $this->getViewer(); + $config = $this->loadDefaultConfiguration(); if (!$config) { throw new Exception( @@ -2542,6 +2544,8 @@ abstract class PhabricatorEditEngine continue; } + $bulk_type->setViewer($viewer); + $bulk_label = $type->getBulkEditLabel(); if ($bulk_label === null) { continue; -- 2.51.2