3 final class PhamePostVisibilityTransaction
4 extends PhamePostTransactionType
{
6 const TRANSACTIONTYPE
= 'phame.post.visibility';
8 public function generateOldValue($object) {
9 return $object->getVisibility();
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);
18 $object->setDatePublished(PhabricatorTime
::getNow());
20 $object->setVisibility($value);
23 public function getTitle() {
24 $new = $this->getNewValue();
25 if ($new == PhameConstants
::VISIBILITY_DRAFT
) {
27 '%s marked this post as a draft.',
28 $this->renderAuthor());
29 } else if ($new == PhameConstants
::VISIBILITY_ARCHIVED
) {
31 '%s archived this post.',
32 $this->renderAuthor());
35 '%s published this post.',
36 $this->renderAuthor());
40 public function getTitleForFeed() {
41 $new = $this->getNewValue();
42 if ($new == PhameConstants
::VISIBILITY_DRAFT
) {
44 '%s marked %s as a draft.',
45 $this->renderAuthor(),
46 $this->renderObject());
47 } else if ($new == PhameConstants
::VISIBILITY_ARCHIVED
) {
49 '%s marked %s as archived.',
50 $this->renderAuthor(),
51 $this->renderObject());
55 $this->renderAuthor(),
56 $this->renderObject());
60 public function getIcon() {
61 $new = $this->getNewValue();
62 if ($new == PhameConstants
::VISIBILITY_PUBLISHED
) {
64 } else if ($new == PhameConstants
::VISIBILITY_ARCHIVED
) {
67 return 'fa-eye-slash';