@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 59 lines 1.4 kB view raw
1<?php 2 3final class PhameBlogNameTransaction 4 extends PhameBlogTransactionType { 5 6 const TRANSACTIONTYPE = 'phame.blog.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 return pht( 18 '%s renamed this blog from %s to %s.', 19 $this->renderAuthor(), 20 $this->renderOldValue(), 21 $this->renderNewValue()); 22 } 23 24 public function getTitleForFeed() { 25 return pht( 26 '%s renamed %s blog from %s to %s.', 27 $this->renderAuthor(), 28 $this->renderObject(), 29 $this->renderOldValue(), 30 $this->renderNewValue()); 31 } 32 33 public function validateTransactions($object, array $xactions) { 34 $errors = array(); 35 36 if ($this->isEmptyTextTransaction($object->getName(), $xactions)) { 37 $errors[] = $this->newRequiredError( 38 pht('Blogs must have a name.')); 39 } 40 41 $max_length = $object->getColumnMaximumByteLength('name'); 42 foreach ($xactions as $xaction) { 43 $new_value = $xaction->getNewValue(); 44 $new_length = strlen($new_value); 45 if ($new_length > $max_length) { 46 $errors[] = $this->newInvalidError( 47 pht('The name can be no longer than %s characters.', 48 new PhutilNumber($max_length))); 49 } 50 } 51 52 return $errors; 53 } 54 55 public function getIcon() { 56 return 'fa-rss'; 57 } 58 59}