@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 58 lines 1.5 kB view raw
1<?php 2 3final class PhabricatorProjectTriggerNameTransaction 4 extends PhabricatorProjectTriggerTransactionType { 5 6 const TRANSACTIONTYPE = '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) && strlen($new)) { 21 return pht( 22 '%s renamed this trigger from %s to %s.', 23 $this->renderAuthor(), 24 $this->renderOldValue(), 25 $this->renderNewValue()); 26 } else if (strlen($new)) { 27 return pht( 28 '%s named this trigger %s.', 29 $this->renderAuthor(), 30 $this->renderNewValue()); 31 } else { 32 return pht( 33 '%s stripped the name %s from this trigger.', 34 $this->renderAuthor(), 35 $this->renderOldValue()); 36 } 37 } 38 39 public function validateTransactions($object, array $xactions) { 40 $errors = array(); 41 42 $max_length = $object->getColumnMaximumByteLength('name'); 43 foreach ($xactions as $xaction) { 44 $new_value = $xaction->getNewValue(); 45 $new_length = strlen($new_value); 46 if ($new_length > $max_length) { 47 $errors[] = $this->newInvalidError( 48 pht( 49 'Trigger names must not be longer than %s characters.', 50 new PhutilNumber($max_length)), 51 $xaction); 52 } 53 } 54 55 return $errors; 56 } 57 58}