1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-03-29 12:38:12 +01:00
phorge-phorge/src/applications/differential/xaction/DifferentialRevisionSummaryTransaction.php
epriestley df939f1337 Fix two issues with embedding other fields inside "Summary" or "Test Plan" in Differential with the web UI
Summary:
Ref T11114. Converting to EditEngine caused us to stop running this validation, since these fields no longer subclass this parent. Restore the validation.

Also, make sure we check the //first// line of the value, too. After the change to make "Tests: xyz" a valid title, you could write silly summaries / test plans and escape the check if the first line was bogus.

Test Plan: {F2493228}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

Differential Revision: https://secure.phabricator.com/D17248
2017-01-25 13:07:30 -08:00

64 lines
1.5 KiB
PHP

<?php
final class DifferentialRevisionSummaryTransaction
extends DifferentialRevisionTransactionType {
const TRANSACTIONTYPE = 'differential.revision.summary';
const EDITKEY = 'summary';
public function generateOldValue($object) {
return $object->getSummary();
}
public function applyInternalEffects($object, $value) {
$object->setSummary($value);
}
public function getTitle() {
return pht(
'%s edited the summary of this revision.',
$this->renderAuthor());
}
public function getTitleForFeed() {
return pht(
'%s updated the summary of %s.',
$this->renderAuthor(),
$this->renderObject());
}
public function hasChangeDetailView() {
return true;
}
public function getMailDiffSectionHeader() {
return pht('CHANGES TO REVISION SUMMARY');
}
public function newChangeDetailView() {
$viewer = $this->getViewer();
return id(new PhabricatorApplicationTransactionTextDiffDetailView())
->setViewer($viewer)
->setOldText($this->getOldValue())
->setNewText($this->getNewValue());
}
public function newRemarkupChanges() {
$changes = array();
$changes[] = $this->newRemarkupChange()
->setOldValue($this->getOldValue())
->setNewValue($this->getNewValue());
return $changes;
}
public function validateTransactions($object, array $xactions) {
return $this->validateCommitMessageCorpusTransactions(
$object,
$xactions,
pht('Summary'));
}
}