1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

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
This commit is contained in:
Chad Little 2015-12-05 13:31:05 -08:00
parent 51268de15f
commit 505ae7e261
2 changed files with 9 additions and 53 deletions

View file

@ -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;
}

View file

@ -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;
}
/**