Differential D14259 Diff 34449 src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php
| Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | public function validateApplicationTransactions( | ||||
| // some invalid or restricted values, but they can't add new ones. | // some invalid or restricted values, but they can't add new ones. | ||||
| foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
| $old = $this->decodeValue($xaction->getOldValue()); | $old = $this->decodeValue($xaction->getOldValue()); | ||||
| $new = $this->decodeValue($xaction->getNewValue()); | $new = $this->decodeValue($xaction->getNewValue()); | ||||
| $add = array_diff($new, $old); | $add = array_diff($new, $old); | ||||
| if (!$add) { | $invalid = PhabricatorObjectQuery::loadInvalidPHIDsForViewer( | ||||
| continue; | $editor->getActor(), | ||||
| } | $add); | ||||
| $objects = id(new PhabricatorObjectQuery()) | |||||
| ->setViewer($editor->getActor()) | |||||
| ->withPHIDs($add) | |||||
| ->execute(); | |||||
| $objects = mpull($objects, null, 'getPHID'); | |||||
| $invalid = array(); | |||||
| foreach ($add as $phid) { | |||||
| if (empty($objects[$phid])) { | |||||
| $invalid[] = $phid; | |||||
| } | |||||
| } | |||||
| if ($invalid) { | if ($invalid) { | ||||
| $error = new PhabricatorApplicationTransactionValidationError( | $error = new PhabricatorApplicationTransactionValidationError( | ||||
| $type, | $type, | ||||
| pht('Invalid'), | pht('Invalid'), | ||||
| pht( | pht( | ||||
| 'Some of the selected PHIDs in field "%s" are invalid or '. | 'Some of the selected PHIDs in field "%s" are invalid or '. | ||||
| 'restricted: %s.', | 'restricted: %s.', | ||||
| ▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines | |||||