From a1a8b9ba657e3c77fdf1b087271428bb1a6433b9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 18 Dec 2015 10:51:10 -0800 Subject: [PATCH] Clean up "HTTP Parameters" view a bit for EditEngine forms Summary: Ref T10004. This lost a couple of fields when I rearranged how descriptions work. Restore them. Test Plan: - Viewed "Using HTTP Parameters". - Everything had nice descriptions. - No more weird phantom/misleading 'comment' transaction in UI. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10004 Differential Revision: https://secure.phabricator.com/D14822 --- .../editor/PhabricatorPolicyEditEngineExtension.php | 7 ++++++- .../PhabricatorSubscriptionsEditEngineExtension.php | 1 + .../PhabricatorApplicationTransactionEditor.php | 12 +++++++++++- ...abricatorApplicationEditHTTPParameterHelpView.php | 6 ++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/applications/policy/editor/PhabricatorPolicyEditEngineExtension.php b/src/applications/policy/editor/PhabricatorPolicyEditEngineExtension.php index 1e97f59e24..fd973c0da7 100644 --- a/src/applications/policy/editor/PhabricatorPolicyEditEngineExtension.php +++ b/src/applications/policy/editor/PhabricatorPolicyEditEngineExtension.php @@ -45,6 +45,7 @@ final class PhabricatorPolicyEditEngineExtension 'capability' => PhabricatorPolicyCapability::CAN_VIEW, 'label' => pht('View Policy'), 'description' => pht('Controls who can view the object.'), + 'description.conduit' => pht('Change the view policy of the object.'), 'edit' => 'view', ), PhabricatorTransactions::TYPE_EDIT_POLICY => array( @@ -53,6 +54,7 @@ final class PhabricatorPolicyEditEngineExtension 'capability' => PhabricatorPolicyCapability::CAN_EDIT, 'label' => pht('Edit Policy'), 'description' => pht('Controls who can edit the object.'), + 'description.conduit' => pht('Change the edit policy of the object.'), 'edit' => 'edit', ), PhabricatorTransactions::TYPE_JOIN_POLICY => array( @@ -61,6 +63,7 @@ final class PhabricatorPolicyEditEngineExtension 'capability' => PhabricatorPolicyCapability::CAN_JOIN, 'label' => pht('Join Policy'), 'description' => pht('Controls who can join the object.'), + 'description.conduit' => pht('Change the join policy of the object.'), 'edit' => 'join', ), ); @@ -76,6 +79,7 @@ final class PhabricatorPolicyEditEngineExtension $aliases = $spec['aliases']; $label = $spec['label']; $description = $spec['description']; + $conduit_description = $spec['description.conduit']; $edit = $spec['edit']; $policy_field = id(new PhabricatorPolicyEditField()) @@ -87,7 +91,8 @@ final class PhabricatorPolicyEditEngineExtension ->setPolicies($policies) ->setTransactionType($type) ->setEditTypeKey($edit) - ->setConduitDescription($description) + ->setDescription($description) + ->setConduitDescription($conduit_description) ->setConduitTypeDescription(pht('New policy PHID or constant.')) ->setValue($object->getPolicy($capability)); $fields[] = $policy_field; diff --git a/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsEditEngineExtension.php b/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsEditEngineExtension.php index 2898c1202a..19b9281d02 100644 --- a/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsEditEngineExtension.php +++ b/src/applications/subscriptions/engineextension/PhabricatorSubscriptionsEditEngineExtension.php @@ -45,6 +45,7 @@ final class PhabricatorSubscriptionsEditEngineExtension ->setIsCopyable(true) ->setUseEdgeTransactions(true) ->setCommentActionLabel(pht('Change Subscribers')) + ->setDescription(pht('Choose subscribers.')) ->setTransactionType($subscribers_type) ->setValue($sub_phids); diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 830a35ca44..f8b0917f5a 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -840,8 +840,18 @@ abstract class PhabricatorApplicationTransactionEditor throw $ex; } + // TODO: Once everything is on EditEngine, just use getIsNewObject() to + // figure this out instead. + $mark_as_create = false; + $create_type = PhabricatorTransactions::TYPE_CREATE; foreach ($xactions as $xaction) { - if ($this->getIsNewObject()) { + if ($xaction->getTransactionType() == $create_type) { + $mark_as_create = true; + } + } + + if ($mark_as_create) { + foreach ($xactions as $xaction) { $xaction->setIsCreateTransaction(true); } } diff --git a/src/applications/transactions/view/PhabricatorApplicationEditHTTPParameterHelpView.php b/src/applications/transactions/view/PhabricatorApplicationEditHTTPParameterHelpView.php index bd6ffaa807..767e392248 100644 --- a/src/applications/transactions/view/PhabricatorApplicationEditHTTPParameterHelpView.php +++ b/src/applications/transactions/view/PhabricatorApplicationEditHTTPParameterHelpView.php @@ -39,11 +39,17 @@ final class PhabricatorApplicationEditHTTPParameterHelpView // Remove fields which do not expose an HTTP parameter type. $types = array(); foreach ($fields as $key => $field) { + if (!$field->shouldGenerateTransactionsFromSubmit()) { + unset($fields[$key]); + continue; + } + $type = $field->getHTTPParameterType(); if ($type === null) { unset($fields[$key]); continue; } + $types[$type->getTypeName()] = $type; }