mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-08 22:01:03 +01:00
Generate newValue for ManiphestTaskPointTransaction
Summary: I think this is the correct fix, sets a consistent value for transactions, old and new, for Maniphest point values. Test Plan: Edit title, see no point feed story, set points, see point story, set points to same value, see no story, remove points, see remove point story. {F4958233} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17885
This commit is contained in:
parent
d6a620be45
commit
904480dc3c
1 changed files with 15 additions and 7 deletions
|
@ -6,16 +6,14 @@ final class ManiphestTaskPointsTransaction
|
|||
const TRANSACTIONTYPE = 'points';
|
||||
|
||||
public function generateOldValue($object) {
|
||||
return $object->getPoints();
|
||||
return $this->getValueForPoints($object->getPoints());
|
||||
}
|
||||
|
||||
public function generateNewValue($object, $value) {
|
||||
return $this->getValueForPoints($value);
|
||||
}
|
||||
|
||||
public function applyInternalEffects($object, $value) {
|
||||
if (!strlen($value)) {
|
||||
$value = null;
|
||||
}
|
||||
if ($value !== null) {
|
||||
$value = (double)$value;
|
||||
}
|
||||
$object->setPoints($value);
|
||||
}
|
||||
|
||||
|
@ -73,4 +71,14 @@ final class ManiphestTaskPointsTransaction
|
|||
return $errors;
|
||||
}
|
||||
|
||||
private function getValueForPoints($value) {
|
||||
if (!strlen($value)) {
|
||||
$value = null;
|
||||
}
|
||||
if ($value !== null) {
|
||||
$value = (double)$value;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue