@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 66 lines 1.8 kB view raw
1<?php 2 3final class PhameBlogParentSiteTransaction 4 extends PhameBlogTransactionType { 5 6 const TRANSACTIONTYPE = 'phame.blog.parent.site'; 7 8 public function generateOldValue($object) { 9 return $object->getParentSite(); 10 } 11 12 public function applyInternalEffects($object, $value) { 13 $object->setParentSite($value); 14 } 15 16 public function getTitle() { 17 $old = $this->getOldValue(); 18 if (!phutil_nonempty_string($old)) { 19 return pht( 20 '%s set this blog\'s parent site to %s.', 21 $this->renderAuthor(), 22 $this->renderNewValue()); 23 } else { 24 return pht( 25 '%s updated the blog\'s parent site from %s to %s.', 26 $this->renderAuthor(), 27 $this->renderOldValue(), 28 $this->renderNewValue()); 29 } 30 } 31 32 public function getTitleForFeed() { 33 $old = $this->getOldValue(); 34 if (!phutil_nonempty_string($old)) { 35 return pht( 36 '%s set %s blog\'s parent site to %s.', 37 $this->renderAuthor(), 38 $this->renderObject(), 39 $this->renderNewValue()); 40 } else { 41 return pht( 42 '%s updated %s blog\'s parent site from %s to %s.', 43 $this->renderAuthor(), 44 $this->renderObject(), 45 $this->renderOldValue(), 46 $this->renderNewValue()); 47 } 48 } 49 50 public function validateTransactions($object, array $xactions) { 51 $errors = array(); 52 53 $max_length = $object->getColumnMaximumByteLength('parentSite'); 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('The parent site can be no longer than %s characters.', 60 new PhutilNumber($max_length))); 61 } 62 } 63 64 return $errors; 65 } 66}