@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.6 kB view raw
1<?php 2 3final class PhabricatorRepositoryServiceTransaction 4 extends PhabricatorRepositoryTransactionType { 5 6 const TRANSACTIONTYPE = 'repo:service'; 7 8 public function generateOldValue($object) { 9 return $object->getAlmanacServicePHID(); 10 } 11 12 public function generateNewValue($object, $value) { 13 if (strlen($value)) { 14 return $value; 15 } 16 17 return null; 18 } 19 20 public function applyInternalEffects($object, $value) { 21 $object->setAlmanacServicePHID($value); 22 } 23 24 public function getTitle() { 25 $old = $this->getOldValue(); 26 $new = $this->getOldValue(); 27 28 if (strlen($old) && !strlen($new)) { 29 return pht( 30 '%s moved storage for this repository from %s to local.', 31 $this->renderAuthor(), 32 $this->renderOldHandle()); 33 } else if (!strlen($old) && strlen($new)) { 34 // TODO: Possibly, we should distinguish between automatic assignment 35 // on creation vs explicit adjustment. 36 return pht( 37 '%s set storage for this repository to %s.', 38 $this->renderAuthor(), 39 $this->renderNewHandle()); 40 } else { 41 return pht( 42 '%s moved storage for this repository from %s to %s.', 43 $this->renderAuthor(), 44 $this->renderOldHandle(), 45 $this->renderNewHandle()); 46 } 47 } 48 49 public function validateTransactions($object, array $xactions) { 50 $errors = array(); 51 52 // TODO: This could use some validation, values should be valid Almanac 53 // services of appropriate types. It's only reachable via the CLI so it's 54 // difficult to get wrong in practice. 55 56 return $errors; 57 } 58 59}