Differential D20286 Diff 48425 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 marked this column visible.', | |||||
amckinley: "unhid this column" | |||||
$this->renderAuthor()); | |||||
case PhabricatorProjectColumn::STATUS_HIDDEN: | |||||
return pht( | |||||
'%s marked this column hidden.', | |||||
amckinleyUnsubmitted Not Done Inline Actions"hid this column" amckinley: "hid this column" | |||||
$this->renderAuthor()); | |||||
} | |||||
} | |||||
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))), | |||||
amckinleyUnsubmitted 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? | |||||
epriestleyAuthorUnsubmitted 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… | |||||
$xaction); | |||||
} | |||||
} | |||||
return $errors; | |||||
} | |||||
} |
"unhid this column"