Christopher Johnson (WMDE) has submitted this change and it was merged.

Change subject: updates to upstream 36a50ccbae1e004eb1bb20003d726593cba6d814 
2015-08-15
......................................................................


updates to upstream 36a50ccbae1e004eb1bb20003d726593cba6d814
2015-08-15

Change-Id: If0582f457509dc0a0560e4ba089c2a6da13d763d
---
M rsrc/phui-object-box.css
M rsrc/phui-workboard-view.css
M src/conduit/SprintCreateConduitAPIMethod.php
M src/conduit/SprintGetStartEndDatesConduitAPIMethod.php
M src/conduit/SprintGetTaskProjectHistoryConduitAPIMethod.php
M src/conduit/SprintSetIsSprintConduitAPIMethod.php
M src/conduit/SprintSetStartEndDatesConduitAPIMethod.php
M src/controller/SprintHistoryController.php
M src/controller/SprintListController.php
M src/controller/SprintProjectProfileController.php
M src/controller/SprintProjectViewController.php
M src/controller/SprintReportController.php
M src/controller/board/SprintBoardColumnDetailController.php
M src/controller/board/SprintBoardColumnEditController.php
M src/controller/board/SprintBoardColumnHideController.php
M src/controller/board/SprintBoardImportController.php
M src/controller/board/SprintBoardMoveController.php
M src/controller/board/SprintBoardReorderController.php
M src/controller/board/SprintBoardTaskEditController.php
M src/controller/board/SprintBoardViewController.php
M src/tests/SprintQueryTest.php
M src/tests/SprintTestCase.php
M src/view/SprintUIObjectBoxView.php
M src/view/SprintView.php
M src/view/reports/SprintHistoryTableView.php
M src/view/reports/SprintReportBurnUpView.php
M src/view/reports/SprintReportOpenTasksView.php
27 files changed, 192 insertions(+), 193 deletions(-)

Approvals:
  Christopher Johnson (WMDE): Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/rsrc/phui-object-box.css b/rsrc/phui-object-box.css
index bd773ce..07db25d 100644
--- a/rsrc/phui-object-box.css
+++ b/rsrc/phui-object-box.css
@@ -38,7 +38,7 @@
     margin: 0;
     border-radius: 0;
     border: 0;
-border-bottom: 1px solid {$thinblueborder};
+    border-bottom: 1px solid {$thinblueborder};
 }
 
 .device-phone .phui-object-box {
@@ -57,44 +57,44 @@
 /* - Object Box Colors ------------------------------------------------------ 
*/
 
 .phui-box-border.phui-object-box-green {
-border: 1px solid {$green};
+    border: 1px solid {$green};
 }
 
 .phui-box-border.phui-object-box-green .phui-header-view {
-color: {$green};
+    color: {$green};
 }
 
 .phui-box-border.phui-object-box-green .phui-header-shell {
-border-bottom-color: {$lightgreen};
+    border-bottom-color: {$lightgreen};
 }
 
 .phui-box-border.phui-object-box-blue {
-border: 1px solid {$blue};
+    border: 1px solid {$blue};
 }
 
 .phui-box-border.phui-object-box-blue .phui-header-view {
-color: {$blue};
+    color: {$blue};
 }
 
 .phui-box-border.phui-object-box-blue .phui-header-shell {
-border-bottom-color: {$lightblue};
+    border-bottom-color: {$lightblue};
 }
 
 .phui-box-border.phui-object-box-red {
-border: 1px solid {$red};
+    border: 1px solid {$red};
 }
 
 .phui-box-border.phui-object-box-red .phui-header-view {
-color: {$red};
+    color: {$red};
 }
 
 .phui-box-border.phui-object-box-red .phui-header-shell {
-border-bottom-color: {$lightred};
+    border-bottom-color: {$lightred};
 }
 
 .phui-object-box-hidden-content {
-background: {$lightgreybackground};
-border-bottom: 1px solid {$thinblueborder};
+    background: {$lightgreybackground};
+    border-bottom: 1px solid {$thinblueborder};
 }
 
 .phui-object-box.phui-object-box-collapsed .phui-object-box-hidden-content {
@@ -109,11 +109,11 @@
 
 /* eh oh el */
 .phui-object-box .phui-object-box + .phui-object-box {
-border-top: 1px solid {$thinblueborder};
+    border-top: 1px solid {$thinblueborder};
 }
 
 .phui-object-box .phui-object-box .phui-header-shell .phui-header-header {
-font-family: {$fontfamily};
+    font-family: {$fontfamily};
 }
 
 .phui-object-box .phui-box-border {
@@ -124,14 +124,14 @@
 
 .phui-object-box .phui-object-box .phui-header-shell .phui-header-view {
     padding: 4px 8px;
-background-color: {$lightgreybackground};
+    background-color: {$lightgreybackground};
 }
 
 .phui-object-box .phui-object-box .phui-header-shell .phui-header-header {
     font-size: 13px;
     margin: 0;
-color: {$darkbluetext};
-font-weight: bold;
+    color: {$darkbluetext};
+    font-weight: bold;
 }
 
 .phui-object-box .phui-object-box .phui-header-shell {
diff --git a/rsrc/phui-workboard-view.css b/rsrc/phui-workboard-view.css
index 4d57612..b48b478 100644
--- a/rsrc/phui-workboard-view.css
+++ b/rsrc/phui-workboard-view.css
@@ -9,14 +9,14 @@
 .device-desktop .phui-workboard-view-shadow {
     overflow-x: auto;
     position: absolute;
-    top: 110px;
+    top: 96px;
     bottom: 0;
     left: 0;
     right: 0;
 }
 
 .device-desktop .page-has-warning .phui-workboard-view-shadow {
-    top: 138px;
+    top: 132px;
 }
 
 .device-desktop.with-durable-column .phui-workboard-view-shadow {
@@ -99,8 +99,20 @@
     margin-right: 8px;
 }
 
+.project-board-header {
+    background-color: #fff;
+    border-bottom: 1px solid {$lightblueborder};
+    padding: 12px;
+    position: relative;
+}
+
+.device .project-board-header {
+    padding: 0;
+}
+
 .project-board-header .phui-header-shell {
-    padding: 20px 16px 20px 20px;
+    padding: 0;
+    border-bottom: 1px solid {$blueborder};
 }
 
 .device .project-board-header .phui-header-shell {
@@ -117,6 +129,22 @@
     padding: 0 8px;
 }
 
+.device-phone .project-board-header .phui-header-subheader {
+    display: block;
+    margin: 8px 0 2px 0;
+    padding: 0;
+}
+
+.device-desktop .phabricator-icon-nav.project-board-nav
+.phabricator-nav-local {
+    margin-top: 64px;
+}
+
+.device-desktop .phabricator-icon-nav.project-board-nav
+.phabricator-nav-content {
+    margin: 0;
+}
+
 .phui-card-list-key {
     color: {$bluetext};
     font-weight: bold;
diff --git a/src/conduit/SprintCreateConduitAPIMethod.php 
b/src/conduit/SprintCreateConduitAPIMethod.php
index 920e40b..266b0bc 100644
--- a/src/conduit/SprintCreateConduitAPIMethod.php
+++ b/src/conduit/SprintCreateConduitAPIMethod.php
@@ -28,7 +28,7 @@
   }
 
   protected function execute(ConduitAPIRequest $request) {
-    $user = $request->getUser();
+    $user = $request->getViewer();
 
     $this->requireApplicationCapability(
       ProjectCreateProjectsCapability::CAPABILITY,
diff --git a/src/conduit/SprintGetStartEndDatesConduitAPIMethod.php 
b/src/conduit/SprintGetStartEndDatesConduitAPIMethod.php
index f841dd2..6beb024 100644
--- a/src/conduit/SprintGetStartEndDatesConduitAPIMethod.php
+++ b/src/conduit/SprintGetStartEndDatesConduitAPIMethod.php
@@ -25,7 +25,7 @@
   }
 
   protected function execute(ConduitAPIRequest $request) {
-    $user = $request->getUser();
+    $user = $request->getViewer();
     $query = id(new SprintQuery())
         ->setViewer($user);
     $project = id(new PhabricatorProjectQuery())
diff --git a/src/conduit/SprintGetTaskProjectHistoryConduitAPIMethod.php 
b/src/conduit/SprintGetTaskProjectHistoryConduitAPIMethod.php
index 393cc15..f02d5e1 100644
--- a/src/conduit/SprintGetTaskProjectHistoryConduitAPIMethod.php
+++ b/src/conduit/SprintGetTaskProjectHistoryConduitAPIMethod.php
@@ -25,7 +25,7 @@
   }
 
   protected function execute(ConduitAPIRequest $request) {
-    $user = $request->getUser();
+    $user = $request->getViewer();
 
     $this->requireApplicationCapability(
         ProjectCreateProjectsCapability::CAPABILITY,
diff --git a/src/conduit/SprintSetIsSprintConduitAPIMethod.php 
b/src/conduit/SprintSetIsSprintConduitAPIMethod.php
index cd7fd91..cc1d953 100644
--- a/src/conduit/SprintSetIsSprintConduitAPIMethod.php
+++ b/src/conduit/SprintSetIsSprintConduitAPIMethod.php
@@ -26,7 +26,7 @@
   }
 
   protected function execute(ConduitAPIRequest $request) {
-    $user = $request->getUser();
+    $user = $request->getViewer();
 
     $this->requireApplicationCapability(
         ProjectCreateProjectsCapability::CAPABILITY,
diff --git a/src/conduit/SprintSetStartEndDatesConduitAPIMethod.php 
b/src/conduit/SprintSetStartEndDatesConduitAPIMethod.php
index f957b60..dfd0e8a 100644
--- a/src/conduit/SprintSetStartEndDatesConduitAPIMethod.php
+++ b/src/conduit/SprintSetStartEndDatesConduitAPIMethod.php
@@ -27,7 +27,7 @@
   }
 
   protected function execute(ConduitAPIRequest $request) {
-    $user = $request->getUser();
+    $user = $request->getViewer();
 
     $this->requireApplicationCapability(
         ProjectCreateProjectsCapability::CAPABILITY,
diff --git a/src/controller/SprintHistoryController.php 
b/src/controller/SprintHistoryController.php
index 39bce1c..e39f7f4 100644
--- a/src/controller/SprintHistoryController.php
+++ b/src/controller/SprintHistoryController.php
@@ -6,7 +6,7 @@
   private $viewer;
 
   public function handleRequest(AphrontRequest $request) {
-    $this->viewer = $request->getUser();
+    $this->viewer = $request->getViewer();
 
     if ($request->isFormPost()) {
       $uri = $request->getRequestURI();
diff --git a/src/controller/SprintListController.php 
b/src/controller/SprintListController.php
index 98f0698..370b188 100644
--- a/src/controller/SprintListController.php
+++ b/src/controller/SprintListController.php
@@ -6,7 +6,7 @@
   private $viewer;
 
   public function handleRequest(AphrontRequest $request) {
-    $this->viewer = $request->getUser();
+    $this->viewer = $request->getViewer();
 
     $error_box = null;
     $sprintlist_model = id(new SprintListDataProvider())
diff --git a/src/controller/SprintProjectProfileController.php 
b/src/controller/SprintProjectProfileController.php
index 634bf18..05f32a0 100644
--- a/src/controller/SprintProjectProfileController.php
+++ b/src/controller/SprintProjectProfileController.php
@@ -8,10 +8,10 @@
   }
 
   public function handleRequest(AphrontRequest $request) {
-    $user = $request->getUser();
+    $viewer = $request->getViewer();
 
     $query = id(new PhabricatorProjectQuery())
-      ->setViewer($user)
+      ->setViewer($viewer)
       ->needMembers(true)
       ->needWatchers(true)
       ->needImages(true)
@@ -36,7 +36,7 @@
 
     $header = id(new PHUIHeaderView())
       ->setHeader($project->getName())
-      ->setUser($user)
+      ->setUser($viewer)
       ->setPolicyObject($project)
       ->setImage($picture);
 
@@ -73,7 +73,7 @@
 
   private function buildActionListView(PhabricatorProject $project) {
     $request = $this->getRequest();
-    $viewer = $request->getUser();
+    $viewer = $request->getViewer();
 
     $id = $project->getID();
 
@@ -165,7 +165,7 @@
     PhabricatorProject $project,
     PhabricatorActionListView $actions) {
     $request = $this->getRequest();
-    $viewer = $request->getUser();
+    $viewer = $request->getViewer();
 
     $view = id(new PHUIPropertyListView())
       ->setUser($viewer)
diff --git a/src/controller/SprintProjectViewController.php 
b/src/controller/SprintProjectViewController.php
index c5a0d19..c2d6024 100644
--- a/src/controller/SprintProjectViewController.php
+++ b/src/controller/SprintProjectViewController.php
@@ -9,10 +9,10 @@
 
   public function handleRequest(AphrontRequest $request) {
     $request = $this->getRequest();
-    $user = $request->getUser();
+    $viewer = $request->getViewer();
 
     $query = id(new PhabricatorProjectQuery())
-        ->setViewer($user)
+        ->setViewer($viewer)
         ->needMembers(true)
         ->needWatchers(true)
         ->needImages(true)
@@ -31,7 +31,7 @@
 
 
     $columns = id(new PhabricatorProjectColumnQuery())
-        ->setViewer($user)
+        ->setViewer($viewer)
         ->withProjectPHIDs(array($project->getPHID()))
         ->execute();
     if ($columns) {
diff --git a/src/controller/SprintReportController.php 
b/src/controller/SprintReportController.php
index 0afc60c..a3cec51 100644
--- a/src/controller/SprintReportController.php
+++ b/src/controller/SprintReportController.php
@@ -9,7 +9,7 @@
   }
 
   public function handleRequest(AphrontRequest $request) {
-    $user = $request->getUser();
+    $viewer = $request->getViewer();
 
     if ($request->isFormPost()) {
       $uri = $request->getRequestURI();
@@ -33,18 +33,18 @@
       case 'user':
       case 'project':
       $core = id(new SprintReportOpenTasksView())
-          ->setUser($user)
+          ->setUser($viewer)
           ->setRequest($request)
           ->setView($this->view);
         break;
       case 'burn':
         $core = id(new SprintReportBurnUpView())
-            ->setUser($user)
+            ->setUser($viewer)
             ->setRequest($request);
         break;
       case 'history':
         $core = id(new SprintHistoryTableView())
-            ->setUser($user)
+            ->setUser($viewer)
             ->setRequest($request);
         break;
       default:
diff --git a/src/controller/board/SprintBoardColumnDetailController.php 
b/src/controller/board/SprintBoardColumnDetailController.php
index ab85bd6..5b06486 100644
--- a/src/controller/board/SprintBoardColumnDetailController.php
+++ b/src/controller/board/SprintBoardColumnDetailController.php
@@ -3,17 +3,10 @@
 final class SprintBoardColumnDetailController
   extends SprintBoardController {
 
-  private $id;
-  private $projectID;
-
-  public function willProcessRequest(array $data) {
-    $this->projectID = $data['projectID'];
-    $this->id = idx($data, 'id');
-  }
-
-  public function processRequest() {
-    $request = $this->getRequest();
-    $viewer = $request->getUser();
+  public function handleRequest(AphrontRequest $request) {
+    $viewer = $request->getViewer();
+    $id = $request->getURIData('id');
+    $project_id = $request->getURIData('projectID');
 
     $project = id(new PhabricatorProjectQuery())
       ->setViewer($viewer)
@@ -21,7 +14,7 @@
         array(
           PhabricatorPolicyCapability::CAN_VIEW,
         ))
-      ->withIDs(array($this->projectID))
+      ->withIDs(array($project_id))
       ->needImages(true)
       ->executeOne();
 
@@ -32,7 +25,7 @@
 
     $column = id(new PhabricatorProjectColumnQuery())
       ->setViewer($viewer)
-      ->withIDs(array($this->id))
+      ->withIDs(array($id))
       ->requireCapabilities(
         array(
           PhabricatorPolicyCapability::CAN_VIEW,
diff --git a/src/controller/board/SprintBoardColumnEditController.php 
b/src/controller/board/SprintBoardColumnEditController.php
index e7be1bd..9233f7a 100644
--- a/src/controller/board/SprintBoardColumnEditController.php
+++ b/src/controller/board/SprintBoardColumnEditController.php
@@ -3,17 +3,10 @@
 final class SprintBoardColumnEditController
   extends SprintBoardController {
 
-  private $id;
-  private $projectID;
-
-  public function willProcessRequest(array $data) {
-    $this->projectID = $data['projectID'];
-    $this->id = idx($data, 'id');
-  }
-
-  public function processRequest() {
-    $request = $this->getRequest();
-    $viewer = $request->getUser();
+  public function handleRequest(AphrontRequest $request) {
+    $viewer = $request->getViewer();
+    $id = $request->getURIData('id');
+    $project_id = $request->getURIData('projectID');
 
     $project = id(new PhabricatorProjectQuery())
       ->setViewer($viewer)
@@ -22,7 +15,7 @@
           PhabricatorPolicyCapability::CAN_VIEW,
           PhabricatorPolicyCapability::CAN_EDIT,
         ))
-      ->withIDs(array($this->projectID))
+      ->withIDs(array($project_id ))
       ->needImages(true)
       ->executeOne();
 
@@ -31,12 +24,12 @@
     }
     $this->setProject($project);
 
-    $is_new = ($this->id ? false : true);
+    $is_new = ($id ? false : true);
 
     if (!$is_new) {
       $column = id(new PhabricatorProjectColumnQuery())
         ->setViewer($viewer)
-        ->withIDs(array($this->id))
+        ->withIDs(array($id))
         ->requireCapabilities(
           array(
             PhabricatorPolicyCapability::CAN_VIEW,
@@ -57,12 +50,12 @@
     $v_name = $column->getName();
 
     $validation_exception = null;
-    $base_uri = '/board/'.$this->projectID.'/';
+    $base_uri = '/board/'.$project_id.'/';
     if ($is_new) {
       // we want to go back to the board
       $view_uri = $this->getApplicationURI($base_uri);
     } else {
-      $view_uri = $this->getApplicationURI($base_uri.'column/'.$this->id.'/');
+      $view_uri = $this->getApplicationURI($base_uri.'column/'.$id.'/');
     }
 
     if ($request->isFormPost()) {
diff --git a/src/controller/board/SprintBoardColumnHideController.php 
b/src/controller/board/SprintBoardColumnHideController.php
index 3aaaeb3..6966ef5 100644
--- a/src/controller/board/SprintBoardColumnHideController.php
+++ b/src/controller/board/SprintBoardColumnHideController.php
@@ -3,17 +3,11 @@
 final class SprintBoardColumnHideController
   extends SprintBoardController {
 
-  private $id;
-  private $projectID;
+  public function handleRequest(AphrontRequest $request) {
+    $viewer = $request->getViewer();
+    $id = $request->getURIData('id');
+    $project_id = $request->getURIData('projectID');
 
-  public function willProcessRequest(array $data) {
-    $this->projectID = $data['projectID'];
-    $this->id = idx($data, 'id');
-  }
-
-  public function processRequest() {
-    $request = $this->getRequest();
-    $viewer = $request->getUser();
     $project = id(new PhabricatorProjectQuery())
       ->setViewer($viewer)
       ->requireCapabilities(
@@ -21,7 +15,7 @@
           PhabricatorPolicyCapability::CAN_VIEW,
           PhabricatorPolicyCapability::CAN_EDIT,
         ))
-      ->withIDs(array($this->projectID))
+      ->withIDs(array($project_id))
       ->executeOne();
 
     if (!$project) {
@@ -31,7 +25,7 @@
 
     $column = id(new PhabricatorProjectColumnQuery())
       ->setViewer($viewer)
-      ->withIDs(array($this->id))
+      ->withIDs(array($id))
       ->requireCapabilities(
         array(
           PhabricatorPolicyCapability::CAN_VIEW,
@@ -44,7 +38,7 @@
 
     $column_phid = $column->getPHID();
 
-    $view_uri = $this->getApplicationURI('/board/'.$this->projectID.'/');
+    $view_uri = $this->getApplicationURI('/board/'.$project_id.'/');
     $view_uri = new PhutilURI($view_uri);
     foreach ($request->getPassthroughRequestData() as $key => $value) {
       $view_uri->setQueryParam($key, $value);
@@ -66,9 +60,10 @@
       }
 
       $type_status = PhabricatorProjectColumnTransaction::TYPE_STATUS;
-      $xactions = array(id(new PhabricatorProjectColumnTransaction())
-        ->setTransactionType($type_status)
-        ->setNewValue($new_status),
+      $xactions = array(
+          id(new PhabricatorProjectColumnTransaction())
+              ->setTransactionType($type_status)
+              ->setNewValue($new_status),
       );
 
       $editor = id(new PhabricatorProjectColumnTransactionEditor())
diff --git a/src/controller/board/SprintBoardImportController.php 
b/src/controller/board/SprintBoardImportController.php
index 685fe36..8123a91 100644
--- a/src/controller/board/SprintBoardImportController.php
+++ b/src/controller/board/SprintBoardImportController.php
@@ -3,15 +3,9 @@
 final class SprintBoardImportController
   extends SprintBoardController {
 
-  private $projectID;
-
-  public function willProcessRequest(array $data) {
-    $this->projectID = $data['projectID'];
-  }
-
-  public function processRequest() {
-    $request = $this->getRequest();
-    $viewer = $request->getUser();
+  public function handleRequest(AphrontRequest $request) {
+    $viewer = $request->getViewer();
+    $project_id = $request->getURIData('projectID');
 
     $project = id(new PhabricatorProjectQuery())
       ->setViewer($viewer)
@@ -20,7 +14,7 @@
           PhabricatorPolicyCapability::CAN_VIEW,
           PhabricatorPolicyCapability::CAN_EDIT,
         ))
-      ->withIDs(array($this->projectID))
+      ->withIDs(array($project_id))
       ->executeOne();
     if (!$project) {
       return new Aphront404Response();
diff --git a/src/controller/board/SprintBoardMoveController.php 
b/src/controller/board/SprintBoardMoveController.php
index b28784c..411876f 100644
--- a/src/controller/board/SprintBoardMoveController.php
+++ b/src/controller/board/SprintBoardMoveController.php
@@ -3,15 +3,9 @@
 final class SprintBoardMoveController
   extends SprintBoardController {
 
-  private $id;
-
-  public function willProcessRequest(array $data) {
-    $this->id = $data['id'];
-  }
-
-  public function processRequest() {
-    $request = $this->getRequest();
-    $viewer = $request->getUser();
+  public function handleRequest(AphrontRequest $request) {
+    $viewer = $request->getViewer();
+    $id = $request->getURIData('id');
 
     $column_phid = $request->getStr('columnPHID');
     $object_phid = $request->getStr('objectPHID');
@@ -27,7 +21,7 @@
           PhabricatorPolicyCapability::CAN_VIEW,
           PhabricatorPolicyCapability::CAN_EDIT,
         ))
-      ->withIDs(array($this->id))
+      ->withIDs(array($id))
       ->executeOne();
     if (!$project) {
       return new Aphront404Response();
diff --git a/src/controller/board/SprintBoardReorderController.php 
b/src/controller/board/SprintBoardReorderController.php
index 917fbf3..7c1dbc5 100644
--- a/src/controller/board/SprintBoardReorderController.php
+++ b/src/controller/board/SprintBoardReorderController.php
@@ -3,15 +3,9 @@
 final class SprintBoardReorderController
   extends SprintBoardController {
 
-  private $projectID;
-
-  public function willProcessRequest(array $data) {
-    $this->projectID = $data['projectID'];
-  }
-
-  public function processRequest() {
-    $request = $this->getRequest();
-    $viewer = $request->getUser();
+  public function handleRequest(AphrontRequest $request) {
+    $viewer = $request->getViewer();
+    $projectid = $request->getURIData('projectID');
 
     $project = id(new PhabricatorProjectQuery())
       ->setViewer($viewer)
@@ -20,15 +14,13 @@
           PhabricatorPolicyCapability::CAN_VIEW,
           PhabricatorPolicyCapability::CAN_EDIT,
         ))
-      ->withIDs(array($this->projectID))
+      ->withIDs(array($projectid))
       ->executeOne();
     if (!$project) {
       return new Aphront404Response();
     }
 
     $this->setProject($project);
-
-
     $project_id = $project->getID();
 
     $board_uri = $this->getApplicationURI("board/{$project_id}/");
diff --git a/src/controller/board/SprintBoardTaskEditController.php 
b/src/controller/board/SprintBoardTaskEditController.php
index 57d0d02..6e24638 100644
--- a/src/controller/board/SprintBoardTaskEditController.php
+++ b/src/controller/board/SprintBoardTaskEditController.php
@@ -2,15 +2,9 @@
 
 final class SprintBoardTaskEditController extends ManiphestController {
 
-  private $id;
-
-  public function willProcessRequest(array $data) {
-    $this->id = idx($data, 'id');
-  }
-
-  public function processRequest() {
-    $request = $this->getRequest();
-    $user = $request->getUser();
+  public function handleRequest(AphrontRequest $request) {
+    $viewer = $this->getViewer();
+    $id = $request->getURIData('id');
 
     $response_type = $request->getStr('responseType', 'task');
     $order = $request->getStr('order', 
PhabricatorProjectColumn::DEFAULT_ORDER);
@@ -26,22 +20,22 @@
     $can_edit_status = $this->hasApplicationCapability(
       ManiphestEditStatusCapability::CAPABILITY);
     $can_create_projects = PhabricatorPolicyFilter::hasCapability(
-        $user,
+        $viewer,
         PhabricatorApplication::getByClass('PhabricatorProjectApplication'),
         ProjectCreateProjectsCapability::CAPABILITY);
 
     $parent_task = null;
     $template_id = null;
 
-    if ($this->id) {
+    if ($id) {
       $task = id(new ManiphestTaskQuery())
-        ->setViewer($user)
+        ->setViewer($viewer)
         ->requireCapabilities(
           array(
             PhabricatorPolicyCapability::CAN_VIEW,
             PhabricatorPolicyCapability::CAN_EDIT,
           ))
-        ->withIDs(array($this->id))
+        ->withIDs(array($id))
         ->needSubscriberPHIDs(true)
         ->needProjectPHIDs(true)
         ->executeOne();
@@ -49,7 +43,7 @@
         return new Aphront404Response();
       }
     } else {
-      $task = ManiphestTask::initializeNewTask($user);
+      $task = ManiphestTask::initializeNewTask($viewer);
 
       // We currently do not allow you to set the task status when creating
       // a new task, although now that statuses are custom it might make
@@ -82,7 +76,7 @@
             }
 
             $default_projects = id(new PhabricatorObjectQuery())
-              ->setViewer($user)
+              ->setViewer($viewer)
               ->withNames($tokens)
               ->execute();
             $default_projects = mpull($default_projects, 'getPHID');
@@ -109,12 +103,12 @@
           $assign = $request->getStr('assign');
           if (strlen($assign)) {
             $assign_user = id(new PhabricatorPeopleQuery())
-              ->setViewer($user)
+              ->setViewer($viewer)
               ->withUsernames(array($assign))
               ->executeOne();
             if (!$assign_user) {
               $assign_user = id(new PhabricatorPeopleQuery())
-                ->setViewer($user)
+                ->setViewer($viewer)
                 ->withPHIDs(array($assign))
                 ->executeOne();
             }
@@ -132,7 +126,7 @@
       $parent_id = $request->getInt('parent');
       if (strlen($parent_id)) {
         $parent_task = id(new ManiphestTaskQuery())
-          ->setViewer($user)
+          ->setViewer($viewer)
           ->withIDs(array($parent_id))
           ->executeOne();
         if (!$parent_task) {
@@ -150,10 +144,12 @@
     $field_list = PhabricatorCustomField::getObjectFields(
       $task,
       PhabricatorCustomField::ROLE_EDIT);
-    $field_list->setViewer($user);
+    $field_list->setViewer($viewer);
     $field_list->readFieldsFromStorage($task);
 
     $aux_fields = $field_list->getFields();
+
+    $v_space = $task->getSpacePHID();
 
     if ($request->isFormPost()) {
       $changes = array();
@@ -161,6 +157,7 @@
       $new_title = $request->getStr('title');
       $new_desc = $request->getStr('description');
       $new_status = $request->getStr('status');
+      $v_space = $request->getStr('spacePHID');
 
       if (!$task->getID()) {
         $workflow = 'create';
@@ -247,7 +244,7 @@
           // allow for putting a task in a project column at creation -only-
           if (!$task->getID() && $column_phid && $projects) {
             $column = id(new PhabricatorProjectColumnQuery())
-              ->setViewer($user)
+              ->setViewer($viewer)
               ->withProjectPHIDs($projects)
               ->withPHIDs(array($column_phid))
               ->executeOne();
@@ -268,6 +265,7 @@
         }
 
         if ($can_edit_policies) {
+          $changes[PhabricatorTransactions::TYPE_SPACE] = $v_space;
           $changes[PhabricatorTransactions::TYPE_VIEW_POLICY] =
             $request->getStr('viewPolicy');
           $changes[PhabricatorTransactions::TYPE_EDIT_POLICY] =
@@ -325,7 +323,7 @@
               'new'           => $is_new,
               'transactions'  => $transactions,
             ));
-          $event->setUser($user);
+          $event->setUser($viewer);
           $event->setAphrontRequest($request);
           PhutilEventEngine::dispatchEvent($event);
 
@@ -333,7 +331,7 @@
           $transactions = $event->getValue('transactions');
 
           $editor = id(new ManiphestTransactionEditor())
-            ->setActor($user)
+            ->setActor($viewer)
             ->setContentSourceFromRequest($request)
             ->setContinueOnNoEffect(true)
             ->applyTransactions($task, $transactions);
@@ -345,7 +343,7 @@
               'new'           => $is_new,
               'transactions'  => $transactions,
             ));
-          $event->setUser($user);
+          $event->setUser($viewer);
           $event->setAphrontRequest($request);
           PhutilEventEngine::dispatchEvent($event);
         }
@@ -368,15 +366,15 @@
               $owner = null;
               if ($task->getOwnerPHID()) {
                 $owner = id(new PhabricatorHandleQuery())
-                  ->setViewer($user)
+                  ->setViewer($viewer)
                   ->withPHIDs(array($task->getOwnerPHID()))
                   ->executeOne();
               }
 
-              $project = $this->getSprintProjectforTask($user, $projects);
+              $project = $this->getSprintProjectforTask($viewer, $projects);
 
               $tasks = id(new SprintBoardTaskCard())
-                ->setViewer($user)
+                ->setViewer($viewer)
                 ->setProject($project)
                 ->setTask($task)
                 ->setOwner($owner)
@@ -384,7 +382,7 @@
                 ->getItem();
 
               $column = id(new PhabricatorProjectColumnQuery())
-                ->setViewer($user)
+                ->setViewer($viewer)
                 ->withPHIDs(array($request->getStr('columnPHID')))
                 ->executeOne();
               if (!$column) {
@@ -403,13 +401,13 @@
               }
 
               $positions = id(new PhabricatorProjectColumnPositionQuery())
-                ->setViewer($user)
+                ->setViewer($viewer)
                 ->withColumns(array($column))
                 ->execute();
               $task_phids = mpull($positions, 'getObjectPHID');
 
               $column_tasks = id(new ManiphestTaskQuery())
-                ->setViewer($user)
+                ->setViewer($viewer)
                 ->withPHIDs($task_phids)
                 ->execute();
 
@@ -461,11 +459,11 @@
     } else {
       if (!$task->getID()) {
         $task->attachSubscriberPHIDs(array(
-          $user->getPHID(),
+          $viewer->getPHID(),
         ));
         if ($template_id) {
           $template_task = id(new ManiphestTaskQuery())
-            ->setViewer($user)
+            ->setViewer($viewer)
             ->withIDs(array($template_id))
             ->needSubscriberPHIDs(true)
             ->needProjectPHIDs(true)
@@ -473,13 +471,15 @@
           if ($template_task) {
             $cc_phids = array_unique(array_merge(
               $template_task->getSubscriberPHIDs(),
-              array($user->getPHID())));
+              array($viewer->getPHID())));
             $task->attachSubscriberPHIDs($cc_phids);
             $task->attachProjectPHIDs($template_task->getProjectPHIDs());
             $task->setOwnerPHID($template_task->getOwnerPHID());
             $task->setPriority($template_task->getPriority());
             $task->setViewPolicy($template_task->getViewPolicy());
             $task->setEditPolicy($template_task->getEditPolicy());
+
+            $v_space = $template_task->getSpacePHID();
 
             $template_fields = PhabricatorCustomField::getObjectFields(
               $template_task,
@@ -497,7 +497,7 @@
 
             if ($fields) {
               id(new PhabricatorCustomFieldList($fields))
-                ->setViewer($user)
+                ->setViewer($viewer)
                 ->readFieldsFromStorage($template_task);
 
               foreach ($fields as $key => $field) {
@@ -561,7 +561,7 @@
 
     $form = new AphrontFormView();
     $form
-      ->setUser($user)
+      ->setUser($viewer)
       ->addHiddenInput('template', $template_id)
       ->addHiddenInput('responseType', $response_type)
       ->addHiddenInput('order', $order)
@@ -573,7 +573,7 @@
         ->appendChild(
           id(new AphrontFormStaticControl())
             ->setLabel(pht('Parent Task'))
-            ->setValue($user->renderHandle($parent_task->getPHID())))
+            ->setValue($viewer->renderHandle($parent_task->getPHID())))
         ->addHiddenInput('parent', $parent_task->getID());
     }
 
@@ -605,7 +605,7 @@
     }
 
     $policies = id(new PhabricatorPolicyQuery())
-      ->setViewer($user)
+      ->setViewer($viewer)
       ->setObject($task)
       ->execute();
 
@@ -615,7 +615,7 @@
           ->setLabel(pht('Assigned To'))
           ->setName('assigned_to')
           ->setValue($assigned_value)
-          ->setUser($user)
+          ->setUser($viewer)
           ->setDatasource(new PhabricatorPeopleDatasource())
           ->setLimit(1));
     }
@@ -626,7 +626,7 @@
           ->setLabel(pht('CC'))
           ->setName('cc')
           ->setValue($cc_value)
-          ->setUser($user)
+          ->setUser($viewer)
           ->setDatasource(new PhabricatorMetaMTAMailableDatasource()));
 
     if ($can_edit_priority) {
@@ -643,14 +643,15 @@
       $form
         ->appendChild(
           id(new AphrontFormPolicyControl())
-            ->setUser($user)
+            ->setUser($viewer)
             ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
             ->setPolicyObject($task)
             ->setPolicies($policies)
+            ->setSpacePHID($v_space)
             ->setName('viewPolicy'))
         ->appendChild(
           id(new AphrontFormPolicyControl())
-            ->setUser($user)
+            ->setUser($viewer)
             ->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
             ->setPolicyObject($task)
             ->setPolicies($policies)
@@ -693,14 +694,14 @@
       ->setName('description')
       ->setID('description-textarea')
       ->setValue($task->getDescription())
-      ->setUser($user);
+      ->setUser($viewer);
 
     $form
       ->appendChild($description_control);
 
     if ($request->isAjax()) {
       $dialog = id(new AphrontDialogView())
-        ->setUser($user)
+        ->setUser($viewer)
         ->setWidth(AphrontDialogView::WIDTH_FULL)
         ->setTitle($header_name)
         ->appendChild(
@@ -755,11 +756,17 @@
       ));
   }
 
-  private function getSprintProjectforTask($user, $projects) {
+  private function getSprintProjectforTask($viewer, $projects) {
     $project = null;
-    $query = id(new PhabricatorProjectQuery())
-        ->setViewer($user)
-        ->withPHIDs($projects);
+
+    if ($projects) {
+      $query = id(new PhabricatorProjectQuery())
+          ->setViewer($viewer)
+          ->withPHIDs($projects);
+    } else {
+      return null;
+    }
+
     $projects = $query->execute();
 
     foreach ($projects as $project) {
diff --git a/src/controller/board/SprintBoardViewController.php 
b/src/controller/board/SprintBoardViewController.php
index a38e246..23ea90c 100755
--- a/src/controller/board/SprintBoardViewController.php
+++ b/src/controller/board/SprintBoardViewController.php
@@ -18,7 +18,7 @@
   }
 
   public function handleRequest(AphrontRequest $request) {
-    $viewer = $request->getUser();
+    $viewer = $request->getViewer();
     $id = $request->getURIData('id');
 
     $show_hidden = $request->getBool('hidden');
@@ -559,7 +559,7 @@
     $show_hidden) {
 
     $request = $this->getRequest();
-    $viewer = $request->getUser();
+    $viewer = $request->getViewer();
 
     $can_edit = PhabricatorPolicyFilter::hasCapability(
       $viewer,
@@ -640,7 +640,7 @@
     PhabricatorProjectColumn $column) {
 
     $request = $this->getRequest();
-    $viewer = $request->getUser();
+    $viewer = $request->getViewer();
 
     $can_edit = PhabricatorPolicyFilter::hasCapability(
       $viewer,
diff --git a/src/tests/SprintQueryTest.php b/src/tests/SprintQueryTest.php
index 2cbb7b8..821f0df 100644
--- a/src/tests/SprintQueryTest.php
+++ b/src/tests/SprintQueryTest.php
@@ -8,9 +8,9 @@
 
   public function testRequestSetUser() {
     $r = new AphrontRequest('example.com', '/');
-    $user = $this->generateNewTestUser();
-    $r->setUser($user);
-    $this->assertEquals($user, $r->getUser());
+    $viewer = $this->generateNewTestUser();
+    $r->setUser($viewer);
+    $this->assertEquals($viewer, $r->getUser());
     return $r;
   }
 
@@ -21,8 +21,8 @@
     );
   }
 
-  private function createProject(PhabricatorUser $user) {
-    $project = PhabricatorProject::initializeNewProject($user);
+  private function createProject(PhabricatorUser $viewer) {
+    $project = PhabricatorProject::initializeNewProject($viewer);
     $project->setName('Test Project '.mt_rand());
     return $project;
   }
diff --git a/src/tests/SprintTestCase.php b/src/tests/SprintTestCase.php
index f439be6..0e4137d 100644
--- a/src/tests/SprintTestCase.php
+++ b/src/tests/SprintTestCase.php
@@ -189,11 +189,11 @@
 
   protected function generateNewTestUser() {
 
-    $user = id(new PhabricatorUser())
+    $viewer = id(new PhabricatorUser())
         ->getOmnipotentUser();
-    $user->setTimezoneIdentifier('Europe/Berlin');
+    $viewer->setTimezoneIdentifier('Europe/Berlin');
 
-    return $user;
+    return $viewer;
   }
 
   protected function generateNewTestProject() {
diff --git a/src/view/SprintUIObjectBoxView.php 
b/src/view/SprintUIObjectBoxView.php
index 68d9149..1e98cfc 100644
--- a/src/view/SprintUIObjectBoxView.php
+++ b/src/view/SprintUIObjectBoxView.php
@@ -201,6 +201,9 @@
 
     $showhide = null;
     if ($this->showAction !== null) {
+      if (!$header) {
+        $header = id(new PHUIHeaderView());
+      }
       Javelin::initBehavior('phabricator-reveal-content');
 
       $hide_action_id = celerity_generate_unique_node_id();
diff --git a/src/view/SprintView.php b/src/view/SprintView.php
index 6fbdb03..de20e5a 100644
--- a/src/view/SprintView.php
+++ b/src/view/SprintView.php
@@ -3,10 +3,10 @@
 
 abstract class SprintView extends AphrontView {
   public function renderReportFilters(array $tokens, $has_window, $request,
-                                      $user) {
+                                      $viewer) {
 
     $form = id(new AphrontFormView())
-        ->setUser($user)
+        ->setUser($viewer)
         ->appendControl(
             id(new AphrontFormTokenizerControl())
                 ->setDatasource(new PhabricatorProjectDatasource())
diff --git a/src/view/reports/SprintHistoryTableView.php 
b/src/view/reports/SprintHistoryTableView.php
index 5b48c33..0690887 100644
--- a/src/view/reports/SprintHistoryTableView.php
+++ b/src/view/reports/SprintHistoryTableView.php
@@ -4,10 +4,10 @@
 
   private $request;
   private $tableData;
-  protected $user;
+  protected $viewer;
 
-  public function setViewer (PhabricatorUser $user) {
-    $this->user = $user;
+  public function setViewer (PhabricatorUser $viewer) {
+    $this->user = $viewer;
     return $this;
   }
 
diff --git a/src/view/reports/SprintReportBurnUpView.php 
b/src/view/reports/SprintReportBurnUpView.php
index dca9200..2dd511d 100644
--- a/src/view/reports/SprintReportBurnUpView.php
+++ b/src/view/reports/SprintReportBurnUpView.php
@@ -4,8 +4,8 @@
 
   private $request;
 
-  public function setUser (PhabricatorUser $user) {
-    $this->user = $user;
+  public function setUser (PhabricatorUser $viewer) {
+    $this->user = $viewer;
     return $this;
   }
 
diff --git a/src/view/reports/SprintReportOpenTasksView.php 
b/src/view/reports/SprintReportOpenTasksView.php
index 47825f1..6524203 100644
--- a/src/view/reports/SprintReportOpenTasksView.php
+++ b/src/view/reports/SprintReportOpenTasksView.php
@@ -2,12 +2,12 @@
 
 final class SprintReportOpenTasksView extends SprintView {
 
-    protected $user;
+    protected $viewer;
     private $request;
     private $view;
 
-  public function setUser (PhabricatorUser $user) {
-    $this->user = $user;
+  public function setUser (PhabricatorUser $viewer) {
+    $this->user = $viewer;
     return $this;
   }
 
@@ -52,13 +52,13 @@
 
     $date = phabricator_date(time(), $this->user);
 
-    $user_task_view = new UserOpenTasksView();
+    $viewer_task_view = new UserOpenTasksView();
     $project_task_view = new ProjectOpenTasksView();
 
     if (($this->view) == 'user') {
        list($leftover, $leftover_closed, $base_link, $leftover_name,
            $col_header, $header, $result_closed, $result ) =
-           ($user_task_view->execute($tasks, $recently_closed, $date));
+           ($viewer_task_view->execute($tasks, $recently_closed, $date));
     } else if (($this->view) == 'project') {
         list($leftover, $base_link, $leftover_name, $col_header, $header,
             $result_closed, $leftover_closed, $result ) =
@@ -376,20 +376,20 @@
   }
 
   /**
-   * @param PhabricatorUser $user
+   * @param PhabricatorUser $viewer
    */
-  private function getOpenTasks($user) {
-    $query = $this->openStatusQuery($user);
+  private function getOpenTasks($viewer) {
+    $query = $this->openStatusQuery($viewer);
     $tasks = $query->execute();
     return $tasks;
   }
 
   /**
-   * @param PhabricatorUser $user
+   * @param PhabricatorUser $viewer
    */
-  private function getOpenTasksforProject($user, $phids) {
+  private function getOpenTasksforProject($viewer, $phids) {
     $query = id(new ManiphestTaskQuery())
-        ->setViewer($user)
+        ->setViewer($viewer)
         ->needProjectPHIDs(true)
         ->withEdgeLogicPHIDs(
             PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
@@ -400,9 +400,9 @@
     return $tasks;
   }
 
-  private function openStatusQuery($user) {
+  private function openStatusQuery($viewer) {
     $query = id(new ManiphestTaskQuery())
-        ->setViewer($user)
+        ->setViewer($viewer)
         ->needProjectPHIDs(true)
         ->withStatuses(ManiphestTaskStatus::getOpenStatusConstants());
     return $query;

-- 
To view, visit https://gerrit.wikimedia.org/r/231876
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If0582f457509dc0a0560e4ba089c2a6da13d763d
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/extensions/Sprint
Gerrit-Branch: master
Gerrit-Owner: Christopher Johnson (WMDE) <[email protected]>
Gerrit-Reviewer: Christopher Johnson (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to