1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +01:00

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
This commit is contained in:
epriestley 2015-12-18 10:51:10 -08:00
parent 46e690b2fd
commit a1a8b9ba65
4 changed files with 24 additions and 2 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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;
}