1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01: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; break;
case PhabricatorEditEngineConfigurationTransaction::TYPE_SUBTYPE: case PhabricatorEditEngineConfigurationTransaction::TYPE_SUBTYPE:
$map = $object->getEngine() if ($xactions) {
->setViewer($this->getActor()) $map = $object->getEngine()
->newSubtypeMap(); ->setViewer($this->getActor())
foreach ($xactions as $xaction) { ->newSubtypeMap();
$new = $xaction->getNewValue(); foreach ($xactions as $xaction) {
$new = $xaction->getNewValue();
if (isset($map[$new])) { if (isset($map[$new])) {
continue; 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; break;
} }