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

Change subject: Improves burndown exception error page
......................................................................


Improves burndown exception error page

Bug:T86947
Change-Id: I567d3b2201644025a763e5b59a6c046e72ab3029
---
M src/application/SprintApplication.php
M src/exception/BurndownException.php
M src/query/SprintQuery.php
M src/view/burndown/SprintDataView.php
4 files changed, 23 insertions(+), 20 deletions(-)

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



diff --git a/src/application/SprintApplication.php 
b/src/application/SprintApplication.php
index 31095ab..387dff2 100644
--- a/src/application/SprintApplication.php
+++ b/src/application/SprintApplication.php
@@ -38,10 +38,10 @@
   public function getRoutes() {
 
     return array(
+            // this is the default application route controller
           '/project/sprint/' => array(
               '' => 'SprintListController',
-              'archive/(?P<id>[1-9]\d*)/'
-              => 'PhabricatorProjectArchiveController',
+            // these are forked controllers for the Sprint Board
               'board/(?P<projectID>[1-9]\d*)/' => array(
                   'edit/(?:(?P<id>\d+)/)?'
                   => 'SprintBoardColumnEditController',
@@ -54,15 +54,26 @@
                   'reorder/'
                   => 'SprintBoardReorderController',
               ),
+            // these allow task creation and editing from a Sprint Board
               'board/task/edit/(?P<id>[1-9]\d*)/'
               => 'SprintBoardTaskEditController',
               'board/task/create/'
               => 'SprintBoardTaskEditController',
+            // these are for board filters and column queries
               'board/(?P<id>[1-9]\d*)/'.
               '(?P<filter>filter/)?'.
               '(?:query/(?P<queryKey>[^/]+)/)?'
               => 'SprintBoardViewController',
+            // these are native Sprint application controllers
               'burn/(?P<id>\d+)/' => 'SprintDataViewController',
+              'profile/(?P<id>[1-9]\d*)/'
+              => 'SprintProjectProfileController',
+              'report/list/' => 'SprintListController',
+              'report/(?:(?P<view>\w+)/)?' => 'SprintReportController',
+              'view/(?P<id>\d+)/' => 'SprintDataViewController',
+              // all routes following point to default controllers
+              'archive/(?P<id>[1-9]\d*)/'
+              => 'PhabricatorProjectArchiveController',
               'details/(?P<id>[1-9]\d*)/'
               => 'PhabricatorProjectEditDetailsController',
               'feed/(?P<id>[1-9]\d*)/'
@@ -76,15 +87,10 @@
               'move/(?P<id>[1-9]\d*)/' => 'SprintBoardMoveController',
               'picture/(?P<id>[1-9]\d*)/'
               => 'PhabricatorProjectEditPictureController',
-              'profile/(?P<id>[1-9]\d*)/'
-              => 'SprintProjectProfileController',
-              'report/' => 'SprintListController',
-              'report/list/' => 'SprintListController',
-              'report/(?:(?P<view>\w+)/)?' => 'SprintReportController',
               'update/(?P<id>[1-9]\d*)/(?P<action>[^/]+)/'
               => 'PhabricatorProjectUpdateController',
-              'view/(?P<id>\d+)/' => 'SprintDataViewController',
           ),
+          // primary tag route override
           '/tag/' => array(
               '(?P<slug>[^/]+)/' => 'SprintBoardViewController',
               '(?P<slug>[^/]+)/board/' => 'SprintBoardViewController',
diff --git a/src/exception/BurndownException.php 
b/src/exception/BurndownException.php
index 7e05cf5..8ab10af 100644
--- a/src/exception/BurndownException.php
+++ b/src/exception/BurndownException.php
@@ -1,9 +1,3 @@
 <?php
-/**
- * @author Michael Peters
- * @license GPL version 3
- */
 
-class BurndownException extends Exception {
-
-}
+final class BurndownException extends AphrontUsageException {}
diff --git a/src/query/SprintQuery.php b/src/query/SprintQuery.php
index beba531..2dd78f4 100644
--- a/src/query/SprintQuery.php
+++ b/src/query/SprintQuery.php
@@ -112,13 +112,16 @@
     return $xactions;
   }
 
-  public function checkNull($start, $end, $tasks) {
+  public function checkNull($start, $end, $project, $tasks) {
     if (!$start OR !$end) {
-      throw new BurndownException("This project is not set up for Sprints.  "
-          .'Check that it has a start date and end date.');
+      $projhelp = 'To do this go to the Project Edit Details Page';
+      throw new BurndownException("The project \"".$project->getName()
+          ."\" is not set up for Sprints because "
+          ."it has not been assigned a start date and end date. \n", 
$projhelp);
     }
     if (!$tasks) {
-      throw new BurndownException("This project has no tasks.");
+      $taskhelp = 'To add a task go to the Maniphest Query Page';
+      throw new BurndownException('This project has no tasks.', $taskhelp);
     }
   }
 
diff --git a/src/view/burndown/SprintDataView.php 
b/src/view/burndown/SprintDataView.php
index 4d658e1..4d2594f 100644
--- a/src/view/burndown/SprintDataView.php
+++ b/src/view/burndown/SprintDataView.php
@@ -88,7 +88,7 @@
     $aux_fields = $query->getAuxFields($field_list);
     $this->start = $query->getStartDate($aux_fields);
     $this->end = $query->getEndDate($aux_fields);
-    $query->checkNull($this->start, $this->end, $this->tasks);
+    $query->checkNull($this->start, $this->end, $this->project, $this->tasks);
 
     $stats = id(new SprintBuildStats());
     $timezone = $stats->setTimezone($this->viewer);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I567d3b2201644025a763e5b59a6c046e72ab3029
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