Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / phame / xaction / PhamePostVisibilityTransaction.php
blob9c08787e98c31e8e12db71def8ee296fbca8d7c9
1 <?php
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);
17 } else {
18 $object->setDatePublished(PhabricatorTime::getNow());
20 $object->setVisibility($value);
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());
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());
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';