mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 00:10:57 +01:00
Pholio - make create stories include the mock description, if there is one.
Summary: This diff accomplishes this task by adding an arbitrary metadata store to PhabricatorObjectHandle. This seemed like it would be "necessary eventually"; for example if / when we decide we want to show images in these stories we'd need to add some more arbitrary data. A point of debate is this technique will yield the _current_ data and not the data at the time the transaction was originally made. I can see this being both desirable and non-desirable. Otherwise, the best way to do this is to make a new transaction type specifically for create and store exactly what data we think we would need. (and there's probably many other ways but they require much more work...) Test Plan: viewed some pholio create stories and yes, they had the description showing. Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Maniphest Tasks: T3685 Differential Revision: https://secure.phabricator.com/D6767
This commit is contained in:
parent
e8c2b2c3b5
commit
3f0ffaa9eb
3 changed files with 19 additions and 7 deletions
|
@ -250,15 +250,26 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
|
|||
return parent::getTitleForFeed();
|
||||
}
|
||||
|
||||
public function getBodyForFeed() {
|
||||
public function getBodyForFeed(PhabricatorFeedStory $story) {
|
||||
$text = null;
|
||||
switch ($this->getTransactionType()) {
|
||||
case PholioTransactionType::TYPE_NAME:
|
||||
if ($this->getOldValue() === null) {
|
||||
$mock = $story->getPrimaryObject();
|
||||
$text = $mock->getDescription();
|
||||
}
|
||||
break;
|
||||
case PholioTransactionType::TYPE_INLINE:
|
||||
$text = $this->getComment()->getContent();
|
||||
return phutil_escape_html_newlines(
|
||||
phutil_utf8_shorten($text, 128));
|
||||
break;
|
||||
}
|
||||
return parent::getBodyForFeed();
|
||||
|
||||
if ($text) {
|
||||
return phutil_escape_html_newlines(
|
||||
phutil_utf8_shorten($text, 128));
|
||||
}
|
||||
|
||||
return parent::getBodyForFeed($story);
|
||||
}
|
||||
|
||||
public function hasChangeDetails() {
|
||||
|
|
|
@ -44,8 +44,9 @@ class PhabricatorApplicationTransactionFeedStory
|
|||
|
||||
$xaction->setHandles($this->getHandles());
|
||||
$view->setTitle($xaction->getTitleForFeed());
|
||||
if (nonempty($xaction->getBodyForFeed())) {
|
||||
$view->appendChild($xaction->getBodyForFeed());
|
||||
$body = $xaction->getBodyForFeed($this);
|
||||
if (nonempty($body)) {
|
||||
$view->appendChild($body);
|
||||
}
|
||||
|
||||
$view->setImage(
|
||||
|
|
|
@ -383,7 +383,7 @@ abstract class PhabricatorApplicationTransaction
|
|||
return $this->getTitle();
|
||||
}
|
||||
|
||||
public function getBodyForFeed() {
|
||||
public function getBodyForFeed(PhabricatorFeedStory $story) {
|
||||
$old = $this->getOldValue();
|
||||
$new = $this->getNewValue();
|
||||
|
||||
|
|
Loading…
Reference in a new issue