@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 63 lines 1.6 kB view raw
1<?php 2 3final class PhameBlogSubtitleTransaction 4 extends PhameBlogTransactionType { 5 6 const TRANSACTIONTYPE = 'phame.blog.subtitle'; 7 8 public function generateOldValue($object) { 9 return $object->getSubtitle(); 10 } 11 12 public function applyInternalEffects($object, $value) { 13 $object->setSubtitle($value); 14 } 15 16 public function getTitle() { 17 $old = $this->getOldValue(); 18 if ($old === null) { 19 return pht( 20 '%s set this blog\'s subtitle to "%s".', 21 $this->renderAuthor(), 22 $this->renderNewValue()); 23 } else { 24 return pht( 25 '%s updated the blog\'s subtitle to "%s".', 26 $this->renderAuthor(), 27 $this->renderNewValue()); 28 } 29 } 30 31 public function getTitleForFeed() { 32 $old = $this->getOldValue(); 33 if ($old === null) { 34 return pht( 35 '%s set the subtitle for %s.', 36 $this->renderAuthor(), 37 $this->renderObject()); 38 } else { 39 return pht( 40 '%s updated the subtitle for %s.', 41 $this->renderAuthor(), 42 $this->renderObject()); 43 } 44 } 45 46 public function validateTransactions($object, array $xactions) { 47 $errors = array(); 48 49 $max_length = $object->getColumnMaximumByteLength('subtitle'); 50 foreach ($xactions as $xaction) { 51 $new_value = $xaction->getNewValue(); 52 $new_length = strlen($new_value); 53 if ($new_length > $max_length) { 54 $errors[] = $this->newInvalidError( 55 pht('The subtitle can be no longer than %s characters.', 56 new PhutilNumber($max_length))); 57 } 58 } 59 60 return $errors; 61 } 62 63}