Differential D14811 Diff 35807 src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
Show First 20 Lines • Show All 300 Lines • ▼ Show 20 Lines | abstract class PhabricatorApplicationTransactionEditor | ||||
private function getTransactionOldValue( | private function getTransactionOldValue( | ||||
PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
PhabricatorApplicationTransaction $xaction) { | PhabricatorApplicationTransaction $xaction) { | ||||
switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
case PhabricatorTransactions::TYPE_SUBSCRIBERS: | case PhabricatorTransactions::TYPE_SUBSCRIBERS: | ||||
return array_values($this->subscribers); | return array_values($this->subscribers); | ||||
case PhabricatorTransactions::TYPE_VIEW_POLICY: | case PhabricatorTransactions::TYPE_VIEW_POLICY: | ||||
if ($this->getIsNewObject()) { | |||||
return null; | |||||
} | |||||
return $object->getViewPolicy(); | return $object->getViewPolicy(); | ||||
case PhabricatorTransactions::TYPE_EDIT_POLICY: | case PhabricatorTransactions::TYPE_EDIT_POLICY: | ||||
if ($this->getIsNewObject()) { | |||||
return null; | |||||
} | |||||
return $object->getEditPolicy(); | return $object->getEditPolicy(); | ||||
case PhabricatorTransactions::TYPE_JOIN_POLICY: | case PhabricatorTransactions::TYPE_JOIN_POLICY: | ||||
if ($this->getIsNewObject()) { | |||||
return null; | |||||
} | |||||
return $object->getJoinPolicy(); | return $object->getJoinPolicy(); | ||||
case PhabricatorTransactions::TYPE_SPACE: | case PhabricatorTransactions::TYPE_SPACE: | ||||
$space_phid = $object->getSpacePHID(); | |||||
if ($space_phid === null) { | |||||
if ($this->getIsNewObject()) { | if ($this->getIsNewObject()) { | ||||
// In this case, just return `null` so we know this is the initial | |||||
// transaction and it should be hidden. | |||||
return null; | return null; | ||||
} | } | ||||
$space_phid = $object->getSpacePHID(); | |||||
if ($space_phid === null) { | |||||
$default_space = PhabricatorSpacesNamespaceQuery::getDefaultSpace(); | $default_space = PhabricatorSpacesNamespaceQuery::getDefaultSpace(); | ||||
if ($default_space) { | if ($default_space) { | ||||
$space_phid = $default_space->getPHID(); | $space_phid = $default_space->getPHID(); | ||||
} | } | ||||
} | } | ||||
return $space_phid; | return $space_phid; | ||||
case PhabricatorTransactions::TYPE_EDGE: | case PhabricatorTransactions::TYPE_EDGE: | ||||
▲ Show 20 Lines • Show All 3,000 Lines • Show Last 20 Lines |