From 024c331d2ba33f25f7f2bd598d49b454fa2915c8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 27 Feb 2014 15:16:32 -0800 Subject: [PATCH] Improve rendering of new-style Differential comments in feed/notifications Summary: Ref T2222. This probably doesn't get everything, but should improve many of the newer transactions. Test Plan: Looked at feed after making some edits. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2222 Differential Revision: https://secure.phabricator.com/D8368 --- .../storage/DifferentialTransaction.php | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php index 80e2b914ee..f2c50fb2d2 100644 --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -115,6 +115,101 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction { return parent::getTitle(); } + public function getTitleForFeed(PhabricatorFeedStory $story) { + $author_phid = $this->getAuthorPHID(); + $object_phid = $this->getObjectPHID(); + + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + $author_link = $this->renderHandleLink($author_phid); + $object_link = $this->renderHandleLink($object_phid); + + switch ($this->getTransactionType()) { + case self::TYPE_INLINE: + return pht( + '%s added inline comments to %s.', + $author_link, + $object_link); + case self::TYPE_UPDATE: + return pht( + '%s updated the diff for %s.', + $author_link, + $object_link); + case self::TYPE_ACTION: + switch ($new) { + case DifferentialAction::ACTION_ACCEPT: + return pht( + '%s accepted %s.', + $author_link, + $object_link); + case DifferentialAction::ACTION_REJECT: + return pht( + '%s requested changes to %s.', + $author_link, + $object_link); + case DifferentialAction::ACTION_RETHINK: + return pht( + '%s planned changes to %s.', + $author_link, + $object_link); + case DifferentialAction::ACTION_ABANDON: + return pht( + '%s abandoned %s.', + $author_link, + $object_link); + case DifferentialAction::ACTION_CLOSE: + return pht( + '%s closed %s.', + $author_link, + $object_link); + case DifferentialAction::ACTION_REQUEST: + return pht( + '%s requested review of %s.', + $author_link, + $object_link); + case DifferentialAction::ACTION_RECLAIM: + return pht( + '%s reclaimed %s.', + $author_link, + $object_link); + case DifferentialAction::ACTION_RESIGN: + return pht( + '%s resigned from %s.', + $author_link, + $object_link); + case DifferentialAction::ACTION_CLAIM: + return pht( + '%s commandeered %s.', + $author_link, + $object_link); + case DifferentialAction::ACTION_REOPEN: + return pht( + '%s reopened %s.', + $author_link, + $object_link); + } + break; + case self::TYPE_STATUS: + switch ($this->getNewValue()) { + case ArcanistDifferentialRevisionStatus::ACCEPTED: + return pht( + '%s is now accepted and ready to land.', + $object_link); + case ArcanistDifferentialRevisionStatus::NEEDS_REVISION: + return pht( + '%s now requires changes to proceed.', + $object_link); + case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: + return pht( + '%s now requires review to proceed.', + $object_link); + } + } + + return parent::getTitleForFeed($story); + } + public function getIcon() { switch ($this->getTransactionType()) { case self::TYPE_INLINE: