1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Only validate form subtype edits if subtype transactions are present

Summary: Fixes T12347. Ref T12314. Validation gets called no matter what, but is only relevant if the form supports subtypes.

Test Plan: Marked/unmarked a Paste form as editable.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12347, T12314

Differential Revision: https://secure.phabricator.com/D17457
This commit is contained in:
epriestley 2017-03-03 13:41:44 -08:00
parent d2a420d13a
commit 5ed90b2235

View file

@ -57,21 +57,23 @@ final class PhabricatorEditEngineConfigurationEditor
}
break;
case PhabricatorEditEngineConfigurationTransaction::TYPE_SUBTYPE:
$map = $object->getEngine()
->setViewer($this->getActor())
->newSubtypeMap();
foreach ($xactions as $xaction) {
$new = $xaction->getNewValue();
if ($xactions) {
$map = $object->getEngine()
->setViewer($this->getActor())
->newSubtypeMap();
foreach ($xactions as $xaction) {
$new = $xaction->getNewValue();
if (isset($map[$new])) {
continue;
if (isset($map[$new])) {
continue;
}
$errors[] = new PhabricatorApplicationTransactionValidationError(
$type,
pht('Invalid'),
pht('Subtype "%s" is not a valid subtype.', $new),
$xaction);
}
$errors[] = new PhabricatorApplicationTransactionValidationError(
$type,
pht('Invalid'),
pht('Subtype "%s" is not a valid subtype.', $new),
$xaction);
}
break;
}