@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 70 lines 1.9 kB view raw
1<?php 2 3final class PhamePostVisibilityTransaction 4 extends PhamePostTransactionType { 5 6 const TRANSACTIONTYPE = 'phame.post.visibility'; 7 8 public function generateOldValue($object) { 9 return $object->getVisibility(); 10 } 11 12 public function applyInternalEffects($object, $value) { 13 if ($value == PhameConstants::VISIBILITY_DRAFT) { 14 $object->setDatePublished(0); 15 } else if ($value == PhameConstants::VISIBILITY_ARCHIVED) { 16 $object->setDatePublished(0); 17 } else { 18 $object->setDatePublished(PhabricatorTime::getNow()); 19 } 20 $object->setVisibility($value); 21 } 22 23 public function getTitle() { 24 $new = $this->getNewValue(); 25 if ($new == PhameConstants::VISIBILITY_DRAFT) { 26 return pht( 27 '%s marked this post as a draft.', 28 $this->renderAuthor()); 29 } else if ($new == PhameConstants::VISIBILITY_ARCHIVED) { 30 return pht( 31 '%s archived this post.', 32 $this->renderAuthor()); 33 } else { 34 return pht( 35 '%s published this post.', 36 $this->renderAuthor()); 37 } 38 } 39 40 public function getTitleForFeed() { 41 $new = $this->getNewValue(); 42 if ($new == PhameConstants::VISIBILITY_DRAFT) { 43 return pht( 44 '%s marked %s as a draft.', 45 $this->renderAuthor(), 46 $this->renderObject()); 47 } else if ($new == PhameConstants::VISIBILITY_ARCHIVED) { 48 return pht( 49 '%s marked %s as archived.', 50 $this->renderAuthor(), 51 $this->renderObject()); 52 } else { 53 return pht( 54 '%s published %s.', 55 $this->renderAuthor(), 56 $this->renderObject()); 57 } 58 } 59 60 public function getIcon() { 61 $new = $this->getNewValue(); 62 if ($new == PhameConstants::VISIBILITY_PUBLISHED) { 63 return 'fa-rss'; 64 } else if ($new == PhameConstants::VISIBILITY_ARCHIVED) { 65 return 'fa-ban'; 66 } else { 67 return 'fa-eye-slash'; 68 } 69 } 70}