Differential D17412 Diff 41873 src/applications/badges/xaction/PhabricatorBadgesBadgeFlavorTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/badges/xaction/PhabricatorBadgesBadgeFlavorTransaction.php
Show All 24 Lines | public function getTitleForFeed() { | ||||
return pht( | return pht( | ||||
'%s updated %s flavor text from %s to %s.', | '%s updated %s flavor text from %s to %s.', | ||||
$this->renderAuthor(), | $this->renderAuthor(), | ||||
$this->renderObject(), | $this->renderObject(), | ||||
$this->renderOldValue(), | $this->renderOldValue(), | ||||
$this->renderNewValue()); | $this->renderNewValue()); | ||||
} | } | ||||
public function validateTransactions($object, array $xactions) { | |||||
$errors = array(); | |||||
$max_length = $object->getColumnMaximumByteLength('flavor'); | |||||
foreach ($xactions as $xaction) { | |||||
$new_value = $xaction->getNewValue(); | |||||
$new_length = strlen($new_value); | |||||
if ($new_length > $max_length) { | |||||
$errors[] = $this->newRequiredError( | |||||
pht('The flavor text can be no longer than %s characters.', | |||||
new PhutilNumber($max_length))); | |||||
} | |||||
epriestley: Prefer `%s` + `new PhutilNumber()` so we can extract a translation hint and render large… | |||||
} | |||||
return $errors; | |||||
} | |||||
} | } |
Prefer %s + new PhutilNumber() so we can extract a translation hint and render large numbers in a fancy readable way like "1,234" instead of "1234".