Changeset View
Changeset View
Standalone View
Standalone View
src/applications/paste/editor/PhabricatorPasteEditor.php
| Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | foreach ($xactions as $xaction) { | ||||
| if ($xaction->getTransactionType() == $type_title) { | if ($xaction->getTransactionType() == $type_title) { | ||||
| $name = $xaction->getNewValue(); | $name = $xaction->getNewValue(); | ||||
| } | } | ||||
| } | } | ||||
| $this->fileName = $name; | $this->fileName = $name; | ||||
| } | } | ||||
| protected function validateTransaction( | |||||
| PhabricatorLiskDAO $object, | |||||
| $type, | |||||
| array $xactions) { | |||||
| $errors = parent::validateTransaction($object, $type, $xactions); | |||||
| switch ($type) { | |||||
| case PhabricatorPasteTransaction::TYPE_CONTENT: | |||||
| if (!$object->getFilePHID() && !$xactions) { | |||||
| $error = new PhabricatorApplicationTransactionValidationError( | |||||
| $type, | |||||
| pht('Required'), | |||||
| pht('You must provide content to create a paste.'), | |||||
| null); | |||||
| $error->setIsMissingFieldError(true); | |||||
| $errors[] = $error; | |||||
| } | |||||
| break; | |||||
| } | |||||
| return $errors; | |||||
| } | |||||
| protected function getCustomTransactionOldValue( | protected function getCustomTransactionOldValue( | ||||
| PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
| PhabricatorApplicationTransaction $xaction) { | PhabricatorApplicationTransaction $xaction) { | ||||
| switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
| case PhabricatorPasteTransaction::TYPE_CONTENT: | case PhabricatorPasteTransaction::TYPE_CONTENT: | ||||
| return $object->getFilePHID(); | return $object->getFilePHID(); | ||||
| case PhabricatorPasteTransaction::TYPE_TITLE: | case PhabricatorPasteTransaction::TYPE_TITLE: | ||||
| ▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines | |||||