From 904480dc3cfbd78615a06ed87202683d21f5cb33 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Mon, 15 May 2017 11:16:34 -0700 Subject: [PATCH] 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 --- .../ManiphestTaskPointsTransaction.php | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php b/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php index 8a5276ae7e..7f324d1bca 100644 --- a/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php +++ b/src/applications/maniphest/xaction/ManiphestTaskPointsTransaction.php @@ -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; + } + }