Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/storage/DifferentialTransaction.php
Show All 18 Lines | final class DifferentialTransaction extends PhabricatorApplicationTransaction { | ||||
const TYPE_ACTION = 'differential:action'; | const TYPE_ACTION = 'differential:action'; | ||||
const TYPE_STATUS = 'differential:status'; | const TYPE_STATUS = 'differential:status'; | ||||
public function getApplicationName() { | public function getApplicationName() { | ||||
return 'differential'; | return 'differential'; | ||||
} | } | ||||
public function getApplicationTransactionType() { | public function getApplicationTransactionType() { | ||||
return DifferentialPHIDTypeRevision::TYPECONST; | return DifferentialRevisionPHIDType::TYPECONST; | ||||
} | } | ||||
public function getApplicationTransactionCommentObject() { | public function getApplicationTransactionCommentObject() { | ||||
return new DifferentialTransactionComment(); | return new DifferentialTransactionComment(); | ||||
} | } | ||||
public function shouldHide() { | public function shouldHide() { | ||||
$old = $this->getOldValue(); | $old = $this->getOldValue(); | ||||
$new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_UPDATE: | case self::TYPE_UPDATE: | ||||
// Older versions of this transaction have an ID for the new value, | // Older versions of this transaction have an ID for the new value, | ||||
// and/or do not record the old value. Only hide the transaction if | // and/or do not record the old value. Only hide the transaction if | ||||
// the new value is a PHID, indicating that this is a newer style | // the new value is a PHID, indicating that this is a newer style | ||||
// transaction. | // transaction. | ||||
if ($old === null) { | if ($old === null) { | ||||
if (phid_get_type($new) == DifferentialPHIDTypeDiff::TYPECONST) { | if (phid_get_type($new) == DifferentialDiffPHIDType::TYPECONST) { | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
break; | break; | ||||
case PhabricatorTransactions::TYPE_EDGE: | case PhabricatorTransactions::TYPE_EDGE: | ||||
$add = array_diff_key($new, $old); | $add = array_diff_key($new, $old); | ||||
$rem = array_diff_key($old, $new); | $rem = array_diff_key($old, $new); | ||||
▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | public function getTitle() { | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_INLINE: | case self::TYPE_INLINE: | ||||
return pht( | return pht( | ||||
'%s added inline comments.', | '%s added inline comments.', | ||||
$author_handle); | $author_handle); | ||||
case self::TYPE_UPDATE: | case self::TYPE_UPDATE: | ||||
if ($new) { | if ($new) { | ||||
// TODO: Migrate to PHIDs and use handles here? | // TODO: Migrate to PHIDs and use handles here? | ||||
if (phid_get_type($new) == DifferentialPHIDTypeDiff::TYPECONST) { | if (phid_get_type($new) == DifferentialDiffPHIDType::TYPECONST) { | ||||
return pht( | return pht( | ||||
'%s updated this revision to %s.', | '%s updated this revision to %s.', | ||||
$author_handle, | $author_handle, | ||||
$this->renderHandleLink($new)); | $this->renderHandleLink($new)); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
'%s updated this revision.', | '%s updated this revision.', | ||||
$author_handle); | $author_handle); | ||||
▲ Show 20 Lines • Show All 283 Lines • Show Last 20 Lines |