2014-02-21 20:52:52 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialSummaryField
|
|
|
|
extends DifferentialCoreCustomField {
|
|
|
|
|
|
|
|
public function getFieldKey() {
|
|
|
|
return 'differential:summary';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldName() {
|
|
|
|
return pht('Summary');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldDescription() {
|
|
|
|
return pht('Stores a summary of the revision.');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function readValueFromRevision(
|
|
|
|
DifferentialRevision $revision) {
|
|
|
|
return $revision->getSummary();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function writeValueToRevision(
|
|
|
|
DifferentialRevision $revision,
|
|
|
|
$value) {
|
|
|
|
$revision->setSummary($value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function readValueFromRequest(AphrontRequest $request) {
|
|
|
|
$this->setValue($request->getStr($this->getFieldKey()));
|
|
|
|
}
|
|
|
|
|
2014-02-21 20:53:37 +01:00
|
|
|
public function renderEditControl(array $handles) {
|
2014-02-21 20:52:52 +01:00
|
|
|
return id(new PhabricatorRemarkupControl())
|
|
|
|
->setName($this->getFieldKey())
|
|
|
|
->setValue($this->getValue())
|
|
|
|
->setError($this->getFieldError())
|
|
|
|
->setLabel($this->getFieldName());
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionTitle(
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
$author_phid = $xaction->getAuthorPHID();
|
|
|
|
$old = $xaction->getOldValue();
|
|
|
|
$new = $xaction->getNewValue();
|
|
|
|
|
|
|
|
return pht(
|
|
|
|
'%s updated the summary for this revision.',
|
|
|
|
$xaction->renderHandleLink($author_phid));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionTitleForFeed(
|
|
|
|
PhabricatorApplicationTransaction $xaction,
|
|
|
|
PhabricatorFeedStory $story) {
|
|
|
|
|
|
|
|
$object_phid = $xaction->getObjectPHID();
|
|
|
|
$author_phid = $xaction->getAuthorPHID();
|
|
|
|
$old = $xaction->getOldValue();
|
|
|
|
$new = $xaction->getNewValue();
|
|
|
|
|
|
|
|
return pht(
|
|
|
|
'%s updated the summary for %s.',
|
|
|
|
$xaction->renderHandleLink($author_phid),
|
|
|
|
$xaction->renderHandleLink($object_phid));
|
|
|
|
}
|
|
|
|
|
Allow CustomField to provide ApplicationTransaction change details
Summary:
Ref T3886. Ref T418. For fields like "Summary" and "Test Plan" where changes can't be summarized in one line, allow CustomField to provide a "(Show Details)" link and render a diff.
Also consolidate some of the existing copy/paste, and simplify this featuer slightly now that we've move to dialogs.
Test Plan:
{F115918}
- Viewed "description"-style field changes in phlux, pholio, legalpad, maniphest, differential, ponder (questions), ponder (answers), and repositories.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3886, T418
Differential Revision: https://secure.phabricator.com/D8284
2014-02-21 20:53:04 +01:00
|
|
|
public function getApplicationTransactionHasChangeDetails(
|
|
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionChangeDetails(
|
|
|
|
PhabricatorApplicationTransaction $xaction,
|
|
|
|
PhabricatorUser $viewer) {
|
|
|
|
return $xaction->renderTextCorpusChangeDetails(
|
|
|
|
$viewer,
|
|
|
|
$xaction->getOldValue(),
|
|
|
|
$xaction->getNewValue());
|
|
|
|
}
|
2014-02-21 20:52:52 +01:00
|
|
|
|
|
|
|
}
|