Differential D17248 Diff 41490 src/applications/differential/customfield/DifferentialCoreCustomField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/customfield/DifferentialCoreCustomField.php
| Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | foreach ($xactions as $xaction) { | ||||
| $this->getCoreFieldRequiredErrorString(), | $this->getCoreFieldRequiredErrorString(), | ||||
| $xaction); | $xaction); | ||||
| $error->setIsMissingFieldError(true); | $error->setIsMissingFieldError(true); | ||||
| $errors[] = $error; | $errors[] = $error; | ||||
| $this->setFieldError(pht('Required')); | $this->setFieldError(pht('Required')); | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| if (is_string($value)) { | |||||
| $parser = $this->getFieldParser(); | |||||
| $result = $parser->parseCorpus($value); | |||||
| unset($result['__title__']); | |||||
| unset($result['__summary__']); | |||||
| if ($result) { | |||||
| $error = new PhabricatorApplicationTransactionValidationError( | |||||
| $type, | |||||
| pht('Invalid'), | |||||
| pht( | |||||
| 'The value you have entered in "%s" can not be parsed '. | |||||
| 'unambiguously when rendered in a commit message. Edit the '. | |||||
| 'message so that keywords like "Summary:" and "Test Plan:" do '. | |||||
| 'not appear at the beginning of lines. Parsed keys: %s.', | |||||
| $this->getFieldName(), | |||||
| implode(', ', array_keys($result))), | |||||
| $xaction); | |||||
| $errors[] = $error; | |||||
| $this->setFieldError(pht('Invalid')); | |||||
| continue; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| return $errors; | return $errors; | ||||
| } | } | ||||
| private function getFieldParser() { | |||||
| if (!$this->fieldParser) { | |||||
| $viewer = $this->getViewer(); | |||||
| $parser = DifferentialCommitMessageParser::newStandardParser($viewer); | |||||
| // Set custom title and summary keys so we can detect the presence of | |||||
| // "Summary:" in, e.g., a test plan. | |||||
| $parser->setTitleKey('__title__'); | |||||
| $parser->setSummaryKey('__summary__'); | |||||
| $this->fieldParser = $parser; | |||||
| } | |||||
| return $this->fieldParser; | |||||
| } | |||||
| public function canDisableField() { | public function canDisableField() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| public function shouldAppearInApplicationTransactions() { | public function shouldAppearInApplicationTransactions() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines | |||||