Differential D20402 Diff 48691 src/applications/dashboard/xaction/dashboard/PhabricatorDashboardLayoutTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/dashboard/xaction/dashboard/PhabricatorDashboardLayoutTransaction.php
- This file was added.
| <?php | |||||
| final class PhabricatorDashboardLayoutTransaction | |||||
| extends PhabricatorDashboardTransactionType { | |||||
| const TRANSACTIONTYPE = 'dashboard:layoutmode'; | |||||
| public function generateOldValue($object) { | |||||
| return $object->getRawLayoutMode(); | |||||
| } | |||||
| public function applyInternalEffects($object, $value) { | |||||
| $object->setRawLayoutMode($value); | |||||
| } | |||||
| public function getTitle() { | |||||
| $new = $this->getNewValue(); | |||||
| return pht( | |||||
| '%s changed the layout mode for this dashboard from %s to %s.', | |||||
| $this->renderAuthor(), | |||||
| $this->renderOldValue(), | |||||
| $this->renderNewValue()); | |||||
| } | |||||
amckinley: These won't be very human readable. Do we care about strings like "@amckinley changed the… | |||||
Done Inline ActionsI'm going to do another pass on the rendering here after the swap to EditEngine and I fix all the add/remove/move panel transactions. epriestley: I'm going to do another pass on the rendering here after the swap to EditEngine and I fix all… | |||||
| public function validateTransactions($object, array $xactions) { | |||||
| $errors = array(); | |||||
| $mode_map = PhabricatorDashboardLayoutConfig::getLayoutModeSelectOptions(); | |||||
| $old_value = $object->getRawLayoutMode(); | |||||
| foreach ($xactions as $xaction) { | |||||
| $new_value = $xaction->getNewValue(); | |||||
| if ($new_value === $old_value) { | |||||
| continue; | |||||
| } | |||||
| if (!isset($mode_map[$new_value])) { | |||||
| $errors[] = $this->newInvalidError( | |||||
| pht( | |||||
| 'Layout mode "%s" is not valid. Supported layout modes '. | |||||
| 'are: %s.', | |||||
| $new_value, | |||||
| implode(', ', array_keys($mode_map))), | |||||
| $xaction); | |||||
| continue; | |||||
| } | |||||
| } | |||||
| return $errors; | |||||
| } | |||||
| } | |||||
These won't be very human readable. Do we care about strings like "@amckinley changed the layout mode from layout-mode-full to layout-mode-half-and-half"? Or is this somehow going through PhabricatorDashboardLayoutConfig::getLayoutModeSelectOptions() to get the human names?
Oh, and I see the old code didn't render anything for this transaction type anyway.