mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 08:12:40 +01:00
00495e3a0e
Summary: Removes an unused PhabricatorFeedStory Parameter from all getTitleForFeed() and getApplicationTransactionTitleForFeed() functions. Ref D11088 Ref T6545 Test Plan: ran all unit tests and viewed some dashboard feeds Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6545 Differential Revision: https://secure.phabricator.com/D11146
112 lines
2.6 KiB
PHP
112 lines
2.6 KiB
PHP
<?php
|
|
|
|
final class PonderAnswerTransaction
|
|
extends PhabricatorApplicationTransaction {
|
|
|
|
const TYPE_CONTENT = 'ponder.answer:content';
|
|
|
|
public function getApplicationName() {
|
|
return 'ponder';
|
|
}
|
|
|
|
public function getTableName() {
|
|
return 'ponder_answertransaction';
|
|
}
|
|
|
|
public function getApplicationTransactionType() {
|
|
return PonderAnswerPHIDType::TYPECONST;
|
|
}
|
|
|
|
public function getApplicationTransactionCommentObject() {
|
|
return new PonderAnswerTransactionComment();
|
|
}
|
|
|
|
public function getRequiredHandlePHIDs() {
|
|
$phids = parent::getRequiredHandlePHIDs();
|
|
|
|
switch ($this->getTransactionType()) {
|
|
case self::TYPE_CONTENT:
|
|
$phids[] = $this->getObjectPHID();
|
|
break;
|
|
}
|
|
|
|
return $phids;
|
|
}
|
|
|
|
public function getRemarkupBlocks() {
|
|
$blocks = parent::getRemarkupBlocks();
|
|
|
|
switch ($this->getTransactionType()) {
|
|
case self::TYPE_CONTENT:
|
|
$blocks[] = $this->getNewValue();
|
|
break;
|
|
}
|
|
|
|
return $blocks;
|
|
}
|
|
|
|
public function getTitle() {
|
|
$author_phid = $this->getAuthorPHID();
|
|
$object_phid = $this->getObjectPHID();
|
|
|
|
switch ($this->getTransactionType()) {
|
|
case self::TYPE_CONTENT:
|
|
return pht(
|
|
'%s edited %s.',
|
|
$this->renderHandleLink($author_phid),
|
|
$this->renderHandleLink($object_phid));
|
|
}
|
|
|
|
return parent::getTitle();
|
|
}
|
|
|
|
public function getTitleForFeed() {
|
|
$author_phid = $this->getAuthorPHID();
|
|
$object_phid = $this->getObjectPHID();
|
|
|
|
switch ($this->getTransactionType()) {
|
|
case self::TYPE_CONTENT:
|
|
return pht(
|
|
'%s updated %s.',
|
|
$this->renderHandleLink($author_phid),
|
|
$this->renderHandleLink($object_phid));
|
|
}
|
|
|
|
return parent::getTitleForFeed();
|
|
}
|
|
|
|
public function getBodyForFeed(PhabricatorFeedStory $story) {
|
|
$new = $this->getNewValue();
|
|
|
|
$body = null;
|
|
|
|
switch ($this->getTransactionType()) {
|
|
case self::TYPE_CONTENT:
|
|
return phutil_escape_html_newlines(
|
|
id(new PhutilUTF8StringTruncator())
|
|
->setMaximumGlyphs(128)
|
|
->truncateString($new));
|
|
break;
|
|
}
|
|
return parent::getBodyForFeed($story);
|
|
}
|
|
|
|
|
|
public function hasChangeDetails() {
|
|
$old = $this->getOldValue();
|
|
|
|
switch ($this->getTransactionType()) {
|
|
case self::TYPE_CONTENT:
|
|
return $old !== null;
|
|
}
|
|
return parent::hasChangeDetails();
|
|
}
|
|
|
|
public function renderChangeDetails(PhabricatorUser $viewer) {
|
|
return $this->renderTextCorpusChangeDetails(
|
|
$viewer,
|
|
$this->getOldValue(),
|
|
$this->getNewValue());
|
|
}
|
|
|
|
}
|