@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
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 57 lines 1.5 kB view raw
1<?php 2 3final class PhabricatorPasteLanguageTransaction 4 extends PhabricatorPasteTransactionType { 5 6 const TRANSACTIONTYPE = 'paste.language'; 7 8 public function generateOldValue($object) { 9 return $object->getLanguage(); 10 } 11 12 public function applyInternalEffects($object, $value) { 13 $object->setLanguage($value); 14 } 15 16 private function renderLanguageValue($value) { 17 if (!phutil_nonempty_string($value)) { 18 return $this->renderValue(pht('autodetect')); 19 } else { 20 return $this->renderValue($value); 21 } 22 } 23 24 public function getTitle() { 25 return pht( 26 "%s updated the paste's language from %s to %s.", 27 $this->renderAuthor(), 28 $this->renderLanguageValue($this->getOldValue()), 29 $this->renderLanguageValue($this->getNewValue())); 30 } 31 32 public function getTitleForFeed() { 33 return pht( 34 '%s updated the language for %s from %s to %s.', 35 $this->renderAuthor(), 36 $this->renderObject(), 37 $this->renderLanguageValue($this->getOldValue()), 38 $this->renderLanguageValue($this->getNewValue())); 39 } 40 41 public function validateTransactions($object, array $xactions) { 42 $errors = array(); 43 44 foreach ($xactions as $xaction) { 45 $new = $xaction->getNewValue(); 46 47 if ($new !== null && !strlen($new)) { 48 $errors[] = $this->newInvalidError( 49 pht('Paste language must be null or a nonempty string.'), 50 $xaction); 51 } 52 } 53 54 return $errors; 55 } 56 57}