Differential D16063 Diff 38653 src/applications/transactions/storage/PhabricatorApplicationTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
Show First 20 Lines • Show All 687 Lines • ▼ Show 20 Lines | public function shouldHideForFeed() { | ||||
return $this->shouldHide(); | return $this->shouldHide(); | ||||
} | } | ||||
public function getTitleForMail() { | public function getTitleForMail() { | ||||
return id(clone $this)->setRenderingTarget('text')->getTitle(); | return id(clone $this)->setRenderingTarget('text')->getTitle(); | ||||
} | } | ||||
public function getTitleForHTMLMail() { | |||||
$title = $this->getTitleForMail(); | |||||
if ($title === null) { | |||||
return null; | |||||
} | |||||
if ($this->hasChangeDetails()) { | |||||
$details_uri = $this->getChangeDetailsURI(); | |||||
$details_uri = PhabricatorEnv::getProductionURI($details_uri); | |||||
$show_details = phutil_tag( | |||||
'a', | |||||
array( | |||||
'href' => $details_uri, | |||||
), | |||||
pht('(Show Details)')); | |||||
$title = array($title, ' ', $show_details); | |||||
} | |||||
return $title; | |||||
} | |||||
public function getChangeDetailsURI() { | |||||
return '/transactions/detail/'.$this->getPHID().'/'; | |||||
} | |||||
public function getBodyForMail() { | public function getBodyForMail() { | ||||
if ($this->isInlineCommentTransaction()) { | if ($this->isInlineCommentTransaction()) { | ||||
// We don't return inline comment content as mail body content, because | // We don't return inline comment content as mail body content, because | ||||
// applications need to contextualize it (by adding line numbers, for | // applications need to contextualize it (by adding line numbers, for | ||||
// example) in order for it to make sense. | // example) in order for it to make sense. | ||||
return null; | return null; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 598 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
if ($field) { | if ($field) { | ||||
return $field->getApplicationTransactionHasChangeDetails($this); | return $field->getApplicationTransactionHasChangeDetails($this); | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
public function hasChangeDetailsForMail() { | |||||
return $this->hasChangeDetails(); | |||||
} | |||||
public function renderChangeDetailsForMail(PhabricatorUser $viewer) { | |||||
$view = $this->renderChangeDetails($viewer); | |||||
if ($view instanceof PhabricatorApplicationTransactionTextDiffDetailView) { | |||||
return $view->renderForMail(); | |||||
} | |||||
return null; | |||||
} | |||||
public function renderChangeDetails(PhabricatorUser $viewer) { | public function renderChangeDetails(PhabricatorUser $viewer) { | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case PhabricatorTransactions::TYPE_CUSTOMFIELD: | case PhabricatorTransactions::TYPE_CUSTOMFIELD: | ||||
$field = $this->getTransactionCustomField(); | $field = $this->getTransactionCustomField(); | ||||
if ($field) { | if ($field) { | ||||
return $field->getApplicationTransactionChangeDetails($this, $viewer); | return $field->getApplicationTransactionChangeDetails($this, $viewer); | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
return $this->renderTextCorpusChangeDetails( | return $this->renderTextCorpusChangeDetails( | ||||
$viewer, | $viewer, | ||||
$this->getOldValue(), | $this->getOldValue(), | ||||
$this->getNewValue()); | $this->getNewValue()); | ||||
} | } | ||||
public function renderTextCorpusChangeDetails( | public function renderTextCorpusChangeDetails( | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
$old, | $old, | ||||
$new) { | $new) { | ||||
return id(new PhabricatorApplicationTransactionTextDiffDetailView()) | |||||
require_celerity_resource('differential-changeset-view-css'); | |||||
$view = id(new PhabricatorApplicationTransactionTextDiffDetailView()) | |||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setOldText($old) | ->setOldText($old) | ||||
->setNewText($new); | ->setNewText($new); | ||||
return $view->render(); | |||||
} | } | ||||
public function attachTransactionGroup(array $group) { | public function attachTransactionGroup(array $group) { | ||||
assert_instances_of($group, __CLASS__); | assert_instances_of($group, __CLASS__); | ||||
$this->transactionGroup = $group; | $this->transactionGroup = $group; | ||||
return $this; | return $this; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 216 Lines • Show Last 20 Lines |