From 5ea5b0c41c610f660d51357f85346f190d49a88b Mon Sep 17 00:00:00 2001 From: Chad Little Date: Wed, 30 Dec 2015 12:05:39 -0800 Subject: [PATCH] Update some PhamePost transactions Summary: Cleans up some language, colors, etc. Test Plan: Write lots of new posts, hide them, edit them, check history. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T9360 Differential Revision: https://secure.phabricator.com/D14914 --- .../phame/storage/PhamePostTransaction.php | 65 +++++++------------ 1 file changed, 24 insertions(+), 41 deletions(-) diff --git a/src/applications/phame/storage/PhamePostTransaction.php b/src/applications/phame/storage/PhamePostTransaction.php index fcdb7265f8..be5dbfd8b5 100644 --- a/src/applications/phame/storage/PhamePostTransaction.php +++ b/src/applications/phame/storage/PhamePostTransaction.php @@ -4,7 +4,6 @@ final class PhamePostTransaction extends PhabricatorApplicationTransaction { const TYPE_TITLE = 'phame.post.title'; - const TYPE_PHAME_TITLE = 'phame.post.phame.title'; const TYPE_BODY = 'phame.post.body'; const TYPE_VISIBILITY = 'phame.post.visibility'; const TYPE_BLOG = 'phame.post.blog'; @@ -39,12 +38,6 @@ final class PhamePostTransaction } public function shouldHide() { - $old = $this->getOldValue(); - switch ($this->getTransactionType()) { - case self::TYPE_PHAME_TITLE: - case self::TYPE_BODY: - return ($old === null); - } return parent::shouldHide(); } @@ -72,19 +65,18 @@ final class PhamePostTransaction public function getIcon() { $old = $this->getOldValue(); + $new = $this->getNewValue(); switch ($this->getTransactionType()) { - case self::TYPE_TITLE: - if ($old === null) { - return 'fa-plus'; - } else { - return 'fa-pencil'; - } - break; - case self::TYPE_PHAME_TITLE: - case self::TYPE_BODY: + case PhabricatorTransactions::TYPE_CREATE: + return 'fa-plus'; + break; case self::TYPE_VISIBILITY: - return 'fa-pencil'; - break; + if ($new == PhameConstants::VISIBILITY_PUBLISHED) { + return 'fa-globe'; + } else { + return 'fa-eye-slash'; + } + break; } return parent::getIcon(); } @@ -100,7 +92,6 @@ final class PhamePostTransaction $tags[] = self::MAILTAG_SUBSCRIBERS; break; case self::TYPE_TITLE: - case self::TYPE_PHAME_TITLE: case self::TYPE_BODY: $tags[] = self::MAILTAG_CONTENT; break; @@ -123,7 +114,7 @@ final class PhamePostTransaction switch ($type) { case PhabricatorTransactions::TYPE_CREATE: return pht( - '%s created this post.', + '%s authored this post.', $this->renderHandleLink($author_phid)); case self::TYPE_BLOG: return pht( @@ -159,12 +150,6 @@ final class PhamePostTransaction $this->renderHandleLink($author_phid)); } break; - case self::TYPE_PHAME_TITLE: - return pht( - '%s updated the post\'s Phame title to "%s".', - $this->renderHandleLink($author_phid), - rtrim($new, '/')); - break; } return parent::getTitle(); @@ -179,6 +164,11 @@ final class PhamePostTransaction $type = $this->getTransactionType(); switch ($type) { + case PhabricatorTransactions::TYPE_CREATE: + return pht( + '%s authored %s.', + $this->renderHandleLink($author_phid), + $this->renderHandleLink($object_phid)); case self::TYPE_BLOG: return pht( '%s moved post "%s" from "%s" to "%s".', @@ -218,37 +208,30 @@ final class PhamePostTransaction $this->renderHandleLink($object_phid)); } break; - case self::TYPE_PHAME_TITLE: - return pht( - '%s updated the Phame title for %s.', - $this->renderHandleLink($author_phid), - $this->renderHandleLink($object_phid)); - break; } return parent::getTitleForFeed(); } public function getRemarkupBodyForFeed(PhabricatorFeedStory $story) { + $old = $this->getOldValue(); + switch ($this->getTransactionType()) { case self::TYPE_BODY: - return $this->getNewValue(); + if ($old === null) { + return $this->getNewValue(); + } + break; } return null; } public function getColor() { - $old = $this->getOldValue(); - switch ($this->getTransactionType()) { - case self::TYPE_TITLE: - if ($old === null) { - return PhabricatorTransactions::COLOR_GREEN; - } - break; + case PhabricatorTransactions::TYPE_CREATE: + return PhabricatorTransactions::COLOR_GREEN; } - return parent::getColor(); }