@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 71 lines 1.8 kB view raw
1<?php 2 3final class FundInitiativeNameTransaction 4 extends FundInitiativeTransactionType { 5 6 const TRANSACTIONTYPE = 'fund:name'; 7 8 public function generateOldValue($object) { 9 return $object->getName(); 10 } 11 12 public function applyInternalEffects($object, $value) { 13 $object->setName($value); 14 } 15 16 public function getTitle() { 17 $old = $this->getOldValue(); 18 if (!strlen($old)) { 19 return pht( 20 '%s created this initiative.', 21 $this->renderAuthor()); 22 } else { 23 return pht( 24 '%s renamed this initiative from %s to %s.', 25 $this->renderAuthor(), 26 $this->renderOldValue(), 27 $this->renderNewValue()); 28 } 29 } 30 31 public function getTitleForFeed() { 32 $old = $this->getOldValue(); 33 if (!strlen($old)) { 34 return pht( 35 '%s created initiative %s.', 36 $this->renderAuthor(), 37 $this->renderObject()); 38 } else { 39 return pht( 40 '%s renamed %s from %s to %s.', 41 $this->renderAuthor(), 42 $this->renderObject(), 43 $this->renderOldValue(), 44 $this->renderNewValue()); 45 } 46 } 47 48 public function validateTransactions($object, array $xactions) { 49 $errors = array(); 50 51 if ($this->isEmptyTextTransaction($object->getName(), $xactions)) { 52 $errors[] = $this->newRequiredError( 53 pht('Initiatives must have a name.')); 54 } 55 56 $max_length = $object->getColumnMaximumByteLength('name'); 57 foreach ($xactions as $xaction) { 58 $new_value = $xaction->getNewValue(); 59 $new_length = strlen($new_value); 60 if ($new_length > $max_length) { 61 $errors[] = $this->newInvalidError( 62 pht('The name can be no longer than %s characters.', 63 new PhutilNumber($max_length))); 64 } 65 } 66 67 return $errors; 68 } 69 70 71}