1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-09 14:21:02 +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:
Chad Little 2017-05-15 11:16:34 -07:00
parent d6a620be45
commit 904480dc3c

View file

@ -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;
}
}