From 1ed915aef23315c793545f28fbe7647536c23d7b Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 6 May 2011 17:33:40 -0700 Subject: [PATCH] Detect edits which don't actually change projects in Maniphest tasks Summary: Be smarter about detecting when projects haven't actually changed so we don't create silly transactions which just reorder them or change (entirely arbitrary) dictionary keys. Test Plan: Edited a task with several projects and swapped their order, didn't get a bogus project transaction. Reviewed By: tuomaspelkonen Reviewers: tuomaspelkonen, jungejason, aran CC: anjali, sandra, aran, tuomaspelkonen, epriestley Differential Revision: 249 --- .../taskedit/ManiphestTaskEditController.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php b/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php index 16638d8119..0051718021 100644 --- a/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php @@ -112,9 +112,16 @@ class ManiphestTaskEditController extends ManiphestController { $changes[ManiphestTransactionType::TYPE_CCS] = $request->getArr('cc'); } - if ($request->getArr('projects') != $task->getProjectPHIDs()) { - $changes[ManiphestTransactionType::TYPE_PROJECTS] - = $request->getArr('projects'); + $new_proj_arr = $request->getArr('projects'); + $new_proj_arr = array_values($new_proj_arr); + sort($new_proj_arr); + + $cur_proj_arr = $task->getProjectPHIDs(); + $cur_proj_arr = array_values($cur_proj_arr); + sort($cur_proj_arr); + + if ($new_proj_arr != $cur_proj_arr) { + $changes[ManiphestTransactionType::TYPE_PROJECTS] = $new_proj_arr; } if ($files) {