@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 69 lines 1.9 kB view raw
1<?php 2 3final class PhabricatorProjectColumnNameTransaction 4 extends PhabricatorProjectColumnTransactionType { 5 6 const TRANSACTIONTYPE = 'project:col: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 $new = $this->getNewValue(); 19 20 if (!strlen($old)) { 21 return pht( 22 '%s named this column %s.', 23 $this->renderAuthor(), 24 $this->renderNewValue()); 25 } else if (strlen($new)) { 26 return pht( 27 '%s renamed this column from %s to %s.', 28 $this->renderAuthor(), 29 $this->renderOldValue(), 30 $this->renderNewValue()); 31 } else { 32 return pht( 33 '%s removed the custom name of this column.', 34 $this->renderAuthor()); 35 } 36 } 37 38 public function validateTransactions($object, array $xactions) { 39 $errors = array(); 40 41 if ($this->isEmptyTextTransaction($object->getName(), $xactions)) { 42 // The default "Backlog" column is allowed to be unnamed, which 43 // means we use the default name. 44 45 // Proxy columns can't have a name, so don't raise an error here. 46 47 if (!$object->isDefaultColumn() && !$object->getProxy()) { 48 $errors[] = $this->newRequiredError( 49 pht('Columns must have a name.')); 50 } 51 } 52 53 $max_length = $object->getColumnMaximumByteLength('name'); 54 foreach ($xactions as $xaction) { 55 $new_value = $xaction->getNewValue(); 56 $new_length = strlen($new_value); 57 if ($new_length > $max_length) { 58 $errors[] = $this->newInvalidError( 59 pht( 60 'Column names must not be longer than %s characters.', 61 new PhutilNumber($max_length)), 62 $xaction); 63 } 64 } 65 66 return $errors; 67 } 68 69}