@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 82 lines 1.9 kB view raw
1<?php 2 3abstract class PhrictionDocumentEditTransaction 4 extends PhrictionDocumentVersionTransaction { 5 6 public function generateOldValue($object) { 7 if ($this->getEditor()->getIsNewObject()) { 8 return null; 9 } 10 11 // NOTE: We want to get the newest version of the content here, regardless 12 // of whether it's published or not. 13 14 $actor = $this->getActor(); 15 16 return id(new PhrictionContentQuery()) 17 ->setViewer($actor) 18 ->withDocumentPHIDs(array($object->getPHID())) 19 ->setOrder('newest') 20 ->setLimit(1) 21 ->executeOne() 22 ->getContent(); 23 } 24 25 public function generateNewValue($object, $value) { 26 return $value; 27 } 28 29 public function applyInternalEffects($object, $value) { 30 $content = $this->getNewDocumentContent($object); 31 $content->setContent($value); 32 } 33 34 public function getActionStrength() { 35 return 130; 36 } 37 38 public function getActionName() { 39 return pht('Edited'); 40 } 41 42 public function getTitle() { 43 return pht( 44 '%s edited the content of this document.', 45 $this->renderAuthor()); 46 } 47 48 public function getTitleForFeed() { 49 return pht( 50 '%s edited the content of %s.', 51 $this->renderAuthor(), 52 $this->renderObject()); 53 } 54 55 public function getMailDiffSectionHeader() { 56 return pht('CHANGES TO DOCUMENT CONTENT'); 57 } 58 59 public function hasChangeDetailView() { 60 return true; 61 } 62 63 public function newChangeDetailView() { 64 $viewer = $this->getViewer(); 65 66 return id(new PhabricatorApplicationTransactionTextDiffDetailView()) 67 ->setViewer($viewer) 68 ->setOldText($this->getOldValue()) 69 ->setNewText($this->getNewValue()); 70 } 71 72 public function newRemarkupChanges() { 73 $changes = array(); 74 75 $changes[] = $this->newRemarkupChange() 76 ->setOldValue($this->getOldValue()) 77 ->setNewValue($this->getNewValue()); 78 79 return $changes; 80 } 81 82}