1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 11:30:55 +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:
epriestley 2016-11-07 11:30:02 -08:00
parent a8866c0b31
commit 729492a8ff
5 changed files with 35 additions and 1 deletions

View file

@ -30,6 +30,10 @@ final class PhabricatorCalendarEventDescriptionTransaction
return true;
}
public function getMailDiffSectionHeader() {
return pht('CHANGES TO EVENT DESCRIPTION');
}
public function newChangeDetailView() {
$viewer = $this->getViewer();

View file

@ -19,6 +19,10 @@ final class PhabricatorOwnersPackageDescriptionTransaction
$this->renderAuthor());
}
public function getMailDiffSectionHeader() {
return pht('CHANGES TO PACKAGE DESCRIPTION');
}
public function newChangeDetailView() {
return id(new PhabricatorApplicationTransactionTextDiffDetailView())
->setViewer($this->getViewer())

View file

@ -104,6 +104,10 @@ final class PhabricatorPasteContentTransaction
return true;
}
public function getMailDiffSectionHeader() {
return pht('CHANGES TO PASTE CONTENT');
}
public function newChangeDetailView() {
$viewer = $this->getViewer();

View file

@ -1141,9 +1141,15 @@ abstract class PhabricatorApplicationTransactionEditor
PhabricatorLiskDAO $object,
array $xactions) {
$this->object = $object;
$this->xactions = $xactions;
// Hook for edges or other properties that may need (re-)loading
$object = $this->willPublish($object, $xactions);
// The object might have changed, so reassign it.
$this->object = $object;
$messages = array();
if (!$this->getDisableEmail()) {
if ($this->shouldSendMail($object, $xactions)) {
@ -2871,12 +2877,24 @@ abstract class PhabricatorApplicationTransactionEditor
foreach ($details as $xaction) {
$details = $xaction->renderChangeDetailsForMail($body->getViewer());
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
*/

View file

@ -67,6 +67,10 @@ abstract class PhabricatorModularTransactionType
throw new PhutilMethodNotImplementedException();
}
public function getMailDiffSectionHeader() {
return pht('EDIT DETAILS');
}
public function newRemarkupChanges() {
return array();
}