mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Allow transactions to specialize their mail headers for diff sections
Summary: Ref T7643. When we send mail about a change to a package description, allow it to say "CHANGES TO PACKAGE DESCRIPTION" instead of "EDIT DETAILS". Smooth! Test Plan: {F1909417} Reviewers: chad Reviewed By: chad Maniphest Tasks: T7643 Differential Revision: https://secure.phabricator.com/D16818
This commit is contained in:
parent
a8866c0b31
commit
729492a8ff
5 changed files with 35 additions and 1 deletions
|
@ -30,6 +30,10 @@ final class PhabricatorCalendarEventDescriptionTransaction
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMailDiffSectionHeader() {
|
||||||
|
return pht('CHANGES TO EVENT DESCRIPTION');
|
||||||
|
}
|
||||||
|
|
||||||
public function newChangeDetailView() {
|
public function newChangeDetailView() {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,10 @@ final class PhabricatorOwnersPackageDescriptionTransaction
|
||||||
$this->renderAuthor());
|
$this->renderAuthor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMailDiffSectionHeader() {
|
||||||
|
return pht('CHANGES TO PACKAGE DESCRIPTION');
|
||||||
|
}
|
||||||
|
|
||||||
public function newChangeDetailView() {
|
public function newChangeDetailView() {
|
||||||
return id(new PhabricatorApplicationTransactionTextDiffDetailView())
|
return id(new PhabricatorApplicationTransactionTextDiffDetailView())
|
||||||
->setViewer($this->getViewer())
|
->setViewer($this->getViewer())
|
||||||
|
|
|
@ -104,6 +104,10 @@ final class PhabricatorPasteContentTransaction
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMailDiffSectionHeader() {
|
||||||
|
return pht('CHANGES TO PASTE CONTENT');
|
||||||
|
}
|
||||||
|
|
||||||
public function newChangeDetailView() {
|
public function newChangeDetailView() {
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
|
|
@ -1141,9 +1141,15 @@ abstract class PhabricatorApplicationTransactionEditor
|
||||||
PhabricatorLiskDAO $object,
|
PhabricatorLiskDAO $object,
|
||||||
array $xactions) {
|
array $xactions) {
|
||||||
|
|
||||||
|
$this->object = $object;
|
||||||
|
$this->xactions = $xactions;
|
||||||
|
|
||||||
// Hook for edges or other properties that may need (re-)loading
|
// Hook for edges or other properties that may need (re-)loading
|
||||||
$object = $this->willPublish($object, $xactions);
|
$object = $this->willPublish($object, $xactions);
|
||||||
|
|
||||||
|
// The object might have changed, so reassign it.
|
||||||
|
$this->object = $object;
|
||||||
|
|
||||||
$messages = array();
|
$messages = array();
|
||||||
if (!$this->getDisableEmail()) {
|
if (!$this->getDisableEmail()) {
|
||||||
if ($this->shouldSendMail($object, $xactions)) {
|
if ($this->shouldSendMail($object, $xactions)) {
|
||||||
|
@ -2871,12 +2877,24 @@ abstract class PhabricatorApplicationTransactionEditor
|
||||||
foreach ($details as $xaction) {
|
foreach ($details as $xaction) {
|
||||||
$details = $xaction->renderChangeDetailsForMail($body->getViewer());
|
$details = $xaction->renderChangeDetailsForMail($body->getViewer());
|
||||||
if ($details !== null) {
|
if ($details !== null) {
|
||||||
$body->addHTMLSection(pht('EDIT DETAILS'), $details);
|
$label = $this->getMailDiffSectionHeader($xaction);
|
||||||
|
$body->addHTMLSection($label, $details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getMailDiffSectionHeader($xaction) {
|
||||||
|
$type = $xaction->getTransactionType();
|
||||||
|
|
||||||
|
$xtype = $this->getModularTransactionType($type);
|
||||||
|
if ($xtype) {
|
||||||
|
return $xtype->getMailDiffSectionHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pht('EDIT DETAILS');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @task mail
|
* @task mail
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -67,6 +67,10 @@ abstract class PhabricatorModularTransactionType
|
||||||
throw new PhutilMethodNotImplementedException();
|
throw new PhutilMethodNotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMailDiffSectionHeader() {
|
||||||
|
return pht('EDIT DETAILS');
|
||||||
|
}
|
||||||
|
|
||||||
public function newRemarkupChanges() {
|
public function newRemarkupChanges() {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue