@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 64 lines 1.6 kB view raw
1<?php 2 3final class PhamePostBlogTransaction 4 extends PhamePostTransactionType { 5 6 const TRANSACTIONTYPE = 'phame.post.blog'; 7 8 public function generateOldValue($object) { 9 return $object->getBlogPHID(); 10 } 11 12 public function applyInternalEffects($object, $value) { 13 $object->setBlogPHID($value); 14 } 15 16 public function getTitle() { 17 return pht( 18 '%s changed the blog for this post.', 19 $this->renderAuthor()); 20 } 21 22 public function getTitleForFeed() { 23 return pht( 24 '%s changed the blog for post %s.', 25 $this->renderAuthor(), 26 $this->renderObject()); 27 } 28 29 public function validateTransactions($object, array $xactions) { 30 $errors = array(); 31 32 if ($this->isEmptyTextTransaction($object->getBlogPHID(), $xactions)) { 33 $errors[] = $this->newRequiredError( 34 pht('Posts must be attached to a blog.')); 35 } 36 37 foreach ($xactions as $xaction) { 38 $new_phid = $xaction->getNewValue(); 39 40 $blog = id(new PhameBlogQuery()) 41 ->setViewer($this->getActor()) 42 ->withPHIDs(array($new_phid)) 43 ->requireCapabilities( 44 array( 45 PhabricatorPolicyCapability::CAN_VIEW, 46 PhabricatorPolicyCapability::CAN_EDIT, 47 )) 48 ->execute(); 49 50 if ($blog) { 51 continue; 52 } 53 54 $errors[] = $this->newInvalidError( 55 pht('The specified blog PHID ("%s") is not valid. You can only '. 56 'create a post on (or move a post into) a blog which you '. 57 'have permission to see and edit.', 58 $new_phid)); 59 } 60 61 return $errors; 62 } 63 64}