[MediaWiki-commits] [Gerrit] synchs upstream changes to ProjectMoveController and TaskEdi... - change (phabricator...Sprint)

2015-03-27 Thread Christopher Johnson (WMDE) (Code Review)
Christopher Johnson (WMDE) has submitted this change and it was merged.

Change subject: synchs upstream changes to ProjectMoveController and 
TaskEditController with Sprint
..


synchs upstream changes to ProjectMoveController and TaskEditController with 
Sprint

Sprint current with https://secure.phabricator.com/D12162 25-03-2015

Change-Id: I0c405951419476503a02c17bb11fd443e9b04100
---
M src/controller/SprintController.php
M src/controller/board/SprintBoardMoveController.php
M src/controller/board/SprintBoardTaskEditController.php
M src/customfield/SprintBeginDateField.php
M src/customfield/SprintEndDateField.php
M src/customfield/SprintProjectCustomField.php
M src/customfield/SprintTaskStoryPointsField.php
M src/events/BurndownActionMenuEventListener.php
M src/util/BurndownDataDate.php
9 files changed, 41 insertions(+), 43 deletions(-)

Approvals:
  jenkins-bot: Verified



diff --git a/src/controller/SprintController.php 
b/src/controller/SprintController.php
index 39c19c5..461c19e 100644
--- a/src/controller/SprintController.php
+++ b/src/controller/SprintController.php
@@ -1,6 +1,7 @@
 ?php
 /**
  * @author Michael Peters
+ * @author Christopher Johnson
  * @license GPL version 3
  */
 
diff --git a/src/controller/board/SprintBoardMoveController.php 
b/src/controller/board/SprintBoardMoveController.php
index 3b46891..b28784c 100644
--- a/src/controller/board/SprintBoardMoveController.php
+++ b/src/controller/board/SprintBoardMoveController.php
@@ -101,55 +101,46 @@
 
 if ($task_phids  ($order == PhabricatorProjectColumn::ORDER_PRIORITY)) {
   $tasks = id(new ManiphestTaskQuery())
--setViewer($viewer)
--withPHIDs($task_phids)
--requireCapabilities(
-  array(
-PhabricatorPolicyCapability::CAN_VIEW,
-PhabricatorPolicyCapability::CAN_EDIT,
-  ))
--execute();
+  -setViewer($viewer)
+  -withPHIDs($task_phids)
+  -requireCapabilities(
+  array(
+  PhabricatorPolicyCapability::CAN_VIEW,
+  PhabricatorPolicyCapability::CAN_EDIT,
+  ))
+  -execute();
   if (count($tasks) != count($task_phids)) {
 return new Aphront404Response();
   }
   $tasks = mpull($tasks, null, 'getPHID');
 
-  $a_task = idx($tasks, $after_phid);
-  $b_task = idx($tasks, $before_phid);
+  $try = array(
+  array($after_phid, true),
+  array($before_phid, false),
+  );
 
-  if ($a_task 
- (($a_task-getPriority()  $object-getPriority()) ||
-  ($a_task-getPriority() == $object-getPriority() 
-   $a_task-getSubpriority() = $object-getSubpriority( {
-
-$after_pri = $a_task-getPriority();
-$after_sub = $a_task-getSubpriority();
-
-$xactions[] = id(new ManiphestTransaction())
-  -setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY)
-  -setNewValue(array(
-'newPriority' = $after_pri,
-'newSubpriorityBase' = $after_sub,
-'direction' = '',
-  ));
-
-   } else if ($b_task 
- (($b_task-getPriority()  $object-getPriority()) ||
-  ($b_task-getPriority() == $object-getPriority() 
-   $b_task-getSubpriority() = $object-getSubpriority( {
-
-$before_pri = $b_task-getPriority();
-$before_sub = $b_task-getSubpriority();
-
-$xactions[] = id(new ManiphestTransaction())
-  -setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY)
-  -setNewValue(array(
-'newPriority' = $before_pri,
-'newSubpriorityBase' = $before_sub,
-'direction' = '',
-  ));
+  $pri = null;
+  $sub = null;
+  foreach ($try as $spec) {
+list($task_phid, $is_after) = $spec;
+$task = idx($tasks, $task_phid);
+if ($task) {
+  list($pri, $sub) = 
ManiphestTransactionEditor::getAdjacentSubpriority(
+  $task,
+  $is_after);
+  break;
+}
   }
-   }
+
+  if ($pri !== null) {
+$xactions[] = id(new ManiphestTransaction())
+-setTransactionType(ManiphestTransaction::TYPE_PRIORITY)
+-setNewValue($pri);
+$xactions[] = id(new ManiphestTransaction())
+-setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY)
+-setNewValue($sub);
+  }
+}
 
 $editor = id(new ManiphestTransactionEditor())
   -setActor($viewer)
diff --git a/src/controller/board/SprintBoardTaskEditController.php 
b/src/controller/board/SprintBoardTaskEditController.php
index 32dfe1b..4fa8a9c 100644
--- a/src/controller/board/SprintBoardTaskEditController.php
+++ b/src/controller/board/SprintBoardTaskEditController.php
@@ -526,7 +526,7 @@
 
 $error_view = null;
 if ($errors) {
-  $error_view = new PHUIErrorView();
+  

[MediaWiki-commits] [Gerrit] synchs upstream changes to ProjectMoveController and TaskEdi... - change (phabricator...Sprint)

2015-03-26 Thread Christopher Johnson (WMDE) (Code Review)
Christopher Johnson (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/199864

Change subject: synchs upstream changes to ProjectMoveController and 
TaskEditController with Sprint
..

synchs upstream changes to ProjectMoveController and TaskEditController with 
Sprint

Sprint current with D12162 commit 47114513b00f88d4e22070556a2a00dd3339b2af 
25-03-2015

Change-Id: I0c405951419476503a02c17bb11fd443e9b04100
---
M src/controller/SprintController.php
M src/controller/board/SprintBoardMoveController.php
M src/controller/board/SprintBoardTaskEditController.php
M src/customfield/SprintBeginDateField.php
M src/customfield/SprintEndDateField.php
M src/customfield/SprintProjectCustomField.php
M src/customfield/SprintTaskStoryPointsField.php
M src/events/BurndownActionMenuEventListener.php
M src/util/BurndownDataDate.php
9 files changed, 41 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/phabricator/extensions/Sprint 
refs/changes/64/199864/1

diff --git a/src/controller/SprintController.php 
b/src/controller/SprintController.php
index 39c19c5..461c19e 100644
--- a/src/controller/SprintController.php
+++ b/src/controller/SprintController.php
@@ -1,6 +1,7 @@
 ?php
 /**
  * @author Michael Peters
+ * @author Christopher Johnson
  * @license GPL version 3
  */
 
diff --git a/src/controller/board/SprintBoardMoveController.php 
b/src/controller/board/SprintBoardMoveController.php
index 3b46891..b28784c 100644
--- a/src/controller/board/SprintBoardMoveController.php
+++ b/src/controller/board/SprintBoardMoveController.php
@@ -101,55 +101,46 @@
 
 if ($task_phids  ($order == PhabricatorProjectColumn::ORDER_PRIORITY)) {
   $tasks = id(new ManiphestTaskQuery())
--setViewer($viewer)
--withPHIDs($task_phids)
--requireCapabilities(
-  array(
-PhabricatorPolicyCapability::CAN_VIEW,
-PhabricatorPolicyCapability::CAN_EDIT,
-  ))
--execute();
+  -setViewer($viewer)
+  -withPHIDs($task_phids)
+  -requireCapabilities(
+  array(
+  PhabricatorPolicyCapability::CAN_VIEW,
+  PhabricatorPolicyCapability::CAN_EDIT,
+  ))
+  -execute();
   if (count($tasks) != count($task_phids)) {
 return new Aphront404Response();
   }
   $tasks = mpull($tasks, null, 'getPHID');
 
-  $a_task = idx($tasks, $after_phid);
-  $b_task = idx($tasks, $before_phid);
+  $try = array(
+  array($after_phid, true),
+  array($before_phid, false),
+  );
 
-  if ($a_task 
- (($a_task-getPriority()  $object-getPriority()) ||
-  ($a_task-getPriority() == $object-getPriority() 
-   $a_task-getSubpriority() = $object-getSubpriority( {
-
-$after_pri = $a_task-getPriority();
-$after_sub = $a_task-getSubpriority();
-
-$xactions[] = id(new ManiphestTransaction())
-  -setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY)
-  -setNewValue(array(
-'newPriority' = $after_pri,
-'newSubpriorityBase' = $after_sub,
-'direction' = '',
-  ));
-
-   } else if ($b_task 
- (($b_task-getPriority()  $object-getPriority()) ||
-  ($b_task-getPriority() == $object-getPriority() 
-   $b_task-getSubpriority() = $object-getSubpriority( {
-
-$before_pri = $b_task-getPriority();
-$before_sub = $b_task-getSubpriority();
-
-$xactions[] = id(new ManiphestTransaction())
-  -setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY)
-  -setNewValue(array(
-'newPriority' = $before_pri,
-'newSubpriorityBase' = $before_sub,
-'direction' = '',
-  ));
+  $pri = null;
+  $sub = null;
+  foreach ($try as $spec) {
+list($task_phid, $is_after) = $spec;
+$task = idx($tasks, $task_phid);
+if ($task) {
+  list($pri, $sub) = 
ManiphestTransactionEditor::getAdjacentSubpriority(
+  $task,
+  $is_after);
+  break;
+}
   }
-   }
+
+  if ($pri !== null) {
+$xactions[] = id(new ManiphestTransaction())
+-setTransactionType(ManiphestTransaction::TYPE_PRIORITY)
+-setNewValue($pri);
+$xactions[] = id(new ManiphestTransaction())
+-setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY)
+-setNewValue($sub);
+  }
+}
 
 $editor = id(new ManiphestTransactionEditor())
   -setActor($viewer)
diff --git a/src/controller/board/SprintBoardTaskEditController.php 
b/src/controller/board/SprintBoardTaskEditController.php
index 32dfe1b..4fa8a9c 100644
--- a/src/controller/board/SprintBoardTaskEditController.php
+++ b/src/controller/board/SprintBoardTaskEditController.php
@@