From 505ae7e2618941fb13eeaa66009e3140fde5b487 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 5 Dec 2015 13:31:05 -0800 Subject: [PATCH] Update Ponder for Remarkup in Feed Summary: Update Ponder Questions and Answers to render Remarkup in Feed Test Plan: New Question, Edit Question, New Answer, Edit Answer, New Comment. See //remarkup// in Feed. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T9825 Differential Revision: https://secure.phabricator.com/D14648 --- .../storage/PonderAnswerTransaction.php | 16 ++----- .../storage/PonderQuestionTransaction.php | 46 ++----------------- 2 files changed, 9 insertions(+), 53 deletions(-) diff --git a/src/applications/ponder/storage/PonderAnswerTransaction.php b/src/applications/ponder/storage/PonderAnswerTransaction.php index c13cb07b87..924817b34e 100644 --- a/src/applications/ponder/storage/PonderAnswerTransaction.php +++ b/src/applications/ponder/storage/PonderAnswerTransaction.php @@ -38,13 +38,11 @@ final class PonderAnswerTransaction public function getRemarkupBlocks() { $blocks = parent::getRemarkupBlocks(); - switch ($this->getTransactionType()) { case self::TYPE_CONTENT: $blocks[] = $this->getNewValue(); break; } - return $blocks; } @@ -134,20 +132,14 @@ final class PonderAnswerTransaction return parent::getTitleForFeed(); } - public function getBodyForFeed(PhabricatorFeedStory $story) { - $new = $this->getNewValue(); - - $body = null; - + public function getRemarkupBodyForFeed(PhabricatorFeedStory $story) { + $text = null; switch ($this->getTransactionType()) { case self::TYPE_CONTENT: - return phutil_escape_html_newlines( - id(new PhutilUTF8StringTruncator()) - ->setMaximumGlyphs(128) - ->truncateString($new)); + $text = $this->getNewValue(); break; } - return parent::getBodyForFeed($story); + return $text; } diff --git a/src/applications/ponder/storage/PonderQuestionTransaction.php b/src/applications/ponder/storage/PonderQuestionTransaction.php index cb90cc70a4..7abfd247f5 100644 --- a/src/applications/ponder/storage/PonderQuestionTransaction.php +++ b/src/applications/ponder/storage/PonderQuestionTransaction.php @@ -45,13 +45,11 @@ final class PonderQuestionTransaction public function getRemarkupBlocks() { $blocks = parent::getRemarkupBlocks(); - switch ($this->getTransactionType()) { case self::TYPE_CONTENT: $blocks[] = $this->getNewValue(); break; } - return $blocks; } @@ -222,20 +220,6 @@ final class PonderQuestionTransaction return parent::getActionName(); } - public function shouldHide() { - switch ($this->getTransactionType()) { - case self::TYPE_CONTENT: - if ($this->getOldValue() === null) { - return true; - } else { - return false; - } - break; - } - - return parent::shouldHide(); - } - public function getTitleForFeed() { $author_phid = $this->getAuthorPHID(); $object_phid = $this->getObjectPHID(); @@ -302,34 +286,14 @@ final class PonderQuestionTransaction return parent::getTitleForFeed(); } - public function getBodyForFeed(PhabricatorFeedStory $story) { - $new = $this->getNewValue(); - $old = $this->getOldValue(); - - $body = null; - + public function getRemarkupBodyForFeed(PhabricatorFeedStory $story) { + $text = null; switch ($this->getTransactionType()) { - case self::TYPE_TITLE: - if ($old === null) { - $question = $story->getObject($this->getObjectPHID()); - return phutil_escape_html_newlines( - id(new PhutilUTF8StringTruncator()) - ->setMaximumGlyphs(128) - ->truncateString($question->getContent())); - } - break; - case self::TYPE_ANSWERS: - $answer = $this->getNewAnswerObject($story); - if ($answer) { - return phutil_escape_html_newlines( - id(new PhutilUTF8StringTruncator()) - ->setMaximumGlyphs(128) - ->truncateString($answer->getContent())); - } + case self::TYPE_CONTENT: + $text = $this->getNewValue(); break; } - - return parent::getBodyForFeed($story); + return $text; } /**