mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 13:30:55 +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:
parent
46e690b2fd
commit
a1a8b9ba65
4 changed files with 24 additions and 2 deletions
|
@ -45,6 +45,7 @@ final class PhabricatorPolicyEditEngineExtension
|
||||||
'capability' => PhabricatorPolicyCapability::CAN_VIEW,
|
'capability' => PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
'label' => pht('View Policy'),
|
'label' => pht('View Policy'),
|
||||||
'description' => pht('Controls who can view the object.'),
|
'description' => pht('Controls who can view the object.'),
|
||||||
|
'description.conduit' => pht('Change the view policy of the object.'),
|
||||||
'edit' => 'view',
|
'edit' => 'view',
|
||||||
),
|
),
|
||||||
PhabricatorTransactions::TYPE_EDIT_POLICY => array(
|
PhabricatorTransactions::TYPE_EDIT_POLICY => array(
|
||||||
|
@ -53,6 +54,7 @@ final class PhabricatorPolicyEditEngineExtension
|
||||||
'capability' => PhabricatorPolicyCapability::CAN_EDIT,
|
'capability' => PhabricatorPolicyCapability::CAN_EDIT,
|
||||||
'label' => pht('Edit Policy'),
|
'label' => pht('Edit Policy'),
|
||||||
'description' => pht('Controls who can edit the object.'),
|
'description' => pht('Controls who can edit the object.'),
|
||||||
|
'description.conduit' => pht('Change the edit policy of the object.'),
|
||||||
'edit' => 'edit',
|
'edit' => 'edit',
|
||||||
),
|
),
|
||||||
PhabricatorTransactions::TYPE_JOIN_POLICY => array(
|
PhabricatorTransactions::TYPE_JOIN_POLICY => array(
|
||||||
|
@ -61,6 +63,7 @@ final class PhabricatorPolicyEditEngineExtension
|
||||||
'capability' => PhabricatorPolicyCapability::CAN_JOIN,
|
'capability' => PhabricatorPolicyCapability::CAN_JOIN,
|
||||||
'label' => pht('Join Policy'),
|
'label' => pht('Join Policy'),
|
||||||
'description' => pht('Controls who can join the object.'),
|
'description' => pht('Controls who can join the object.'),
|
||||||
|
'description.conduit' => pht('Change the join policy of the object.'),
|
||||||
'edit' => 'join',
|
'edit' => 'join',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -76,6 +79,7 @@ final class PhabricatorPolicyEditEngineExtension
|
||||||
$aliases = $spec['aliases'];
|
$aliases = $spec['aliases'];
|
||||||
$label = $spec['label'];
|
$label = $spec['label'];
|
||||||
$description = $spec['description'];
|
$description = $spec['description'];
|
||||||
|
$conduit_description = $spec['description.conduit'];
|
||||||
$edit = $spec['edit'];
|
$edit = $spec['edit'];
|
||||||
|
|
||||||
$policy_field = id(new PhabricatorPolicyEditField())
|
$policy_field = id(new PhabricatorPolicyEditField())
|
||||||
|
@ -87,7 +91,8 @@ final class PhabricatorPolicyEditEngineExtension
|
||||||
->setPolicies($policies)
|
->setPolicies($policies)
|
||||||
->setTransactionType($type)
|
->setTransactionType($type)
|
||||||
->setEditTypeKey($edit)
|
->setEditTypeKey($edit)
|
||||||
->setConduitDescription($description)
|
->setDescription($description)
|
||||||
|
->setConduitDescription($conduit_description)
|
||||||
->setConduitTypeDescription(pht('New policy PHID or constant.'))
|
->setConduitTypeDescription(pht('New policy PHID or constant.'))
|
||||||
->setValue($object->getPolicy($capability));
|
->setValue($object->getPolicy($capability));
|
||||||
$fields[] = $policy_field;
|
$fields[] = $policy_field;
|
||||||
|
|
|
@ -45,6 +45,7 @@ final class PhabricatorSubscriptionsEditEngineExtension
|
||||||
->setIsCopyable(true)
|
->setIsCopyable(true)
|
||||||
->setUseEdgeTransactions(true)
|
->setUseEdgeTransactions(true)
|
||||||
->setCommentActionLabel(pht('Change Subscribers'))
|
->setCommentActionLabel(pht('Change Subscribers'))
|
||||||
|
->setDescription(pht('Choose subscribers.'))
|
||||||
->setTransactionType($subscribers_type)
|
->setTransactionType($subscribers_type)
|
||||||
->setValue($sub_phids);
|
->setValue($sub_phids);
|
||||||
|
|
||||||
|
|
|
@ -840,8 +840,18 @@ abstract class PhabricatorApplicationTransactionEditor
|
||||||
throw $ex;
|
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) {
|
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);
|
$xaction->setIsCreateTransaction(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,17 @@ final class PhabricatorApplicationEditHTTPParameterHelpView
|
||||||
// Remove fields which do not expose an HTTP parameter type.
|
// Remove fields which do not expose an HTTP parameter type.
|
||||||
$types = array();
|
$types = array();
|
||||||
foreach ($fields as $key => $field) {
|
foreach ($fields as $key => $field) {
|
||||||
|
if (!$field->shouldGenerateTransactionsFromSubmit()) {
|
||||||
|
unset($fields[$key]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$type = $field->getHTTPParameterType();
|
$type = $field->getHTTPParameterType();
|
||||||
if ($type === null) {
|
if ($type === null) {
|
||||||
unset($fields[$key]);
|
unset($fields[$key]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$types[$type->getTypeName()] = $type;
|
$types[$type->getTypeName()] = $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue