mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-26 03:00:45 +01:00
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
This commit is contained in:
parent
d80a53abcc
commit
ce6e020d5d
2 changed files with 0 additions and 56 deletions
|
@ -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}/"))
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue