From ce6e020d5ddb087cb881c3b491b7e55f40cdb424 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 14 Mar 2018 12:12:20 -0700 Subject: [PATCH] Don't make an expensive, unused call to test if a viewer can reassign a task Summary: Depends on D19224. Ref T13106. Computing this is expensive and the value is not used. This came from D15432, but we never actually shipped that feature. Test Plan: Saw local query cost drop from 139 to 110 with no change in functionality. Grepped for removed symbols. Maniphest Tasks: T13106 Differential Revision: https://secure.phabricator.com/D19225 --- .../ManiphestTaskDetailController.php | 3 -- .../editengine/PhabricatorEditEngine.php | 53 ------------------- 2 files changed, 56 deletions(-) diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index ecfb723f97..a11cc4d85f 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -284,9 +284,6 @@ final class ManiphestTaskDetailController extends ManiphestController { $edit_config = $edit_engine->loadDefaultEditConfiguration($task); $can_create = (bool)$edit_config; - $can_reassign = $edit_engine->hasEditAccessToTransaction( - ManiphestTaskOwnerTransaction::TRANSACTIONTYPE); - if ($can_create) { $form_key = $edit_config->getIdentifier(); $edit_uri = id(new PhutilURI("/task/edit/form/{$form_key}/")) diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php index f0d2aae9ea..f8f6f371bc 100644 --- a/src/applications/transactions/editengine/PhabricatorEditEngine.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php @@ -1398,59 +1398,6 @@ abstract class PhabricatorEditEngine } - /** - * Test if the viewer could apply a certain type of change by using the - * normal "Edit" form. - * - * This method returns `true` if the user has access to an edit form and - * that edit form has a field which applied the specified transaction type, - * and that field is visible and editable for the user. - * - * For example, you can use it to test if a user is able to reassign tasks - * or not, prior to rendering dedicated UI for task reassignment. - * - * Note that this method does NOT test if the user can actually edit the - * current object, just if they have access to the related field. - * - * @param const Transaction type to test for. - * @return bool True if the user could "Edit" to apply the transaction type. - */ - final public function hasEditAccessToTransaction($xaction_type) { - $viewer = $this->getViewer(); - - $object = $this->getTargetObject(); - if (!$object) { - $object = $this->newEditableObject(); - } - - $config = $this->loadDefaultEditConfiguration($object); - if (!$config) { - return false; - } - - $fields = $this->buildEditFields($object); - - $field = null; - foreach ($fields as $form_field) { - $field_xaction_type = $form_field->getTransactionType(); - if ($field_xaction_type === $xaction_type) { - $field = $form_field; - break; - } - } - - if (!$field) { - return false; - } - - if (!$field->shouldReadValueFromSubmit()) { - return false; - } - - return true; - } - - public function newNUXButton($text) { $specs = $this->newCreateActionSpecifications(array()); $head = head($specs);