2013-03-21 02:01:52 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhluxTransaction extends PhabricatorApplicationTransaction {
|
|
|
|
|
|
|
|
const TYPE_EDIT_KEY = 'phlux:key';
|
|
|
|
const TYPE_EDIT_VALUE = 'phlux:value';
|
|
|
|
|
|
|
|
public function getApplicationName() {
|
|
|
|
return 'phlux';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionType() {
|
2013-07-24 23:06:50 +02:00
|
|
|
return PhluxPHIDTypeVariable::TYPECONST;
|
2013-03-21 02:01:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionCommentObject() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTitle() {
|
|
|
|
$author_phid = $this->getAuthorPHID();
|
|
|
|
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_EDIT_KEY:
|
|
|
|
return pht(
|
|
|
|
'%s created this variable.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
case self::TYPE_EDIT_VALUE:
|
|
|
|
return pht(
|
|
|
|
'%s updated this variable.',
|
|
|
|
$this->renderHandleLink($author_phid));
|
|
|
|
}
|
|
|
|
|
|
|
|
return parent::getTitle();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasChangeDetails() {
|
|
|
|
switch ($this->getTransactionType()) {
|
|
|
|
case self::TYPE_EDIT_VALUE:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return parent::hasChangeDetails();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderChangeDetails(PhabricatorUser $viewer) {
|
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
|
|
|
return $this->renderTextCorpusChangeDetails(
|
|
|
|
$viewer,
|
|
|
|
json_encode($this->getOldValue()),
|
|
|
|
json_encode($this->getNewValue()));
|
2013-03-21 02:01:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|