Differential D20286 Diff 48494 src/applications/project/xaction/column/PhabricatorProjectColumnStatusTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/xaction/column/PhabricatorProjectColumnStatusTransaction.php
- This file was added.
<?php | |||||
final class PhabricatorProjectColumnStatusTransaction | |||||
extends PhabricatorProjectColumnTransactionType { | |||||
const TRANSACTIONTYPE = 'project:col:status'; | |||||
public function generateOldValue($object) { | |||||
return $object->getStatus(); | |||||
} | |||||
public function applyInternalEffects($object, $value) { | |||||
$object->setStatus($value); | |||||
} | |||||
public function getTitle() { | |||||
$new = $this->getNewValue(); | |||||
switch ($new) { | |||||
case PhabricatorProjectColumn::STATUS_ACTIVE: | |||||
return pht( | |||||
'%s unhid this column.', | |||||
$this->renderAuthor()); | |||||
amckinley: "unhid this column" | |||||
case PhabricatorProjectColumn::STATUS_HIDDEN: | |||||
return pht( | |||||
'%s hid this column.', | |||||
$this->renderAuthor()); | |||||
Not Done Inline Actions"hid this column" amckinley: "hid this column" | |||||
} | |||||
} | |||||
public function validateTransactions($object, array $xactions) { | |||||
$errors = array(); | |||||
$map = array( | |||||
PhabricatorProjectColumn::STATUS_ACTIVE, | |||||
PhabricatorProjectColumn::STATUS_HIDDEN, | |||||
); | |||||
$map = array_fuse($map); | |||||
foreach ($xactions as $xaction) { | |||||
$value = $xaction->getNewValue(); | |||||
if (!isset($map[$value])) { | |||||
$errors[] = $this->newInvalidError( | |||||
pht( | |||||
'Column status "%s" is unrecognized, valid statuses are: %s.', | |||||
$value, | |||||
implode(', ', array_keys($map))), | |||||
$xaction); | |||||
Not Done Inline ActionsThis is just going to be "0, 1"; maybe don't even bother to show it? amckinley: This is just going to be `"0, 1"`; maybe don't even bother to show it? | |||||
Done Inline ActionsI think it'll be real strings some day. Showing it is mostly for the benefit of API callers, since the internal constants may not always be obvious. epriestley: I think it'll be real strings some day. Showing it is mostly for the benefit of API callers… | |||||
} | |||||
} | |||||
return $errors; | |||||
} | |||||
} |
"unhid this column"