Christopher Johnson (WMDE) has uploaded a new change for review.

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

Change subject: only show Sprints in Property List for Task if Task is in a 
Sprint Project
......................................................................

only show Sprints in Property List for Task if Task is in a Sprint Project

Change-Id: I3e2a75937dca90a8a12bad3ff084ea5fa9419460
---
M src/events/SprintUIEventListener.php
1 file changed, 31 insertions(+), 38 deletions(-)


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

diff --git a/src/events/SprintUIEventListener.php 
b/src/events/SprintUIEventListener.php
index 74fc7f3..467f4b2 100644
--- a/src/events/SprintUIEventListener.php
+++ b/src/events/SprintUIEventListener.php
@@ -28,7 +28,8 @@
     return $handles;
   }
 
-  private function handlePropertyEvent($event) {
+  private function handlePropertyEvent($event)
+  {
     $user = $event->getUser();
     $object = $event->getValue('object');
 
@@ -43,17 +44,15 @@
     }
 
     $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
-      $object->getPHID(),
-      PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
+        $object->getPHID(),
+        PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
     if ($project_phids) {
       $project_phids = array_reverse($project_phids);
       $phandles = id(new PhabricatorHandleQuery())
-        ->setViewer($user)
-        ->withPHIDs($project_phids)
-        ->execute();
-     $handles = $this->filterSprints($phandles, SprintConstants::MAGIC_WORD);
-    } else {
-      $handles = array();
+          ->setViewer($user)
+          ->withPHIDs($project_phids)
+          ->execute();
+      $handles = $this->filterSprints($phandles, SprintConstants::MAGIC_WORD);
     }
 
     // If this object can appear on boards, build the workboard annotations.
@@ -69,46 +68,40 @@
       require_celerity_resource('maniphest-task-summary-css');
 
       $positions = id(new PhabricatorProjectColumnPositionQuery())
-        ->setViewer($user)
-        ->withBoardPHIDs($project_phids)
-        ->withObjectPHIDs(array($object->getPHID()))
-        ->needColumns(true)
-        ->execute();
+          ->setViewer($user)
+          ->withBoardPHIDs($project_phids)
+          ->withObjectPHIDs(array($object->getPHID()))
+          ->needColumns(true)
+          ->execute();
       $positions = mpull($positions, null, 'getBoardPHID');
 
       foreach ($handles as $handle) {
         $project_phid = $handle->getPHID();
 
         $position = idx($positions, $project_phid);
-          if ($position) {
-            $column = $position->getColumn();
+        if ($position) {
+          $column = $position->getColumn();
 
-            $column_name = pht('(%s)', $column->getDisplayName());
-            $column_link = phutil_tag(
-                'a',
-                array(
-                    'href' => $handle->getURI().'sboard/',
-                    'class' => 'maniphest-board-link',
-                ),
-                $column_name);
+          $column_name = pht('(%s)', $column->getDisplayName());
+          $column_link = phutil_tag(
+              'a',
+              array(
+                  'href' => $handle->getURI() . 'sboard/',
+                  'class' => 'maniphest-board-link',
+              ),
+              $column_name);
 
-            $annotations[$project_phid] = array(
-                ' ',
-                $column_link);
-          }
+          $annotations[$project_phid] = array(
+              ' ',
+              $column_link);
         }
       }
-
-    if ($handles) {
       $list = id(new PHUIHandleTagListView())
-        ->setHandles($handles)
-        ->setAnnotations($annotations);
-    } else {
-      $list = phutil_tag('em', array(), pht('None'));
+          ->setHandles($handles)
+          ->setAnnotations($annotations);
+
+      $view = $event->getValue('view');
+      $view->addProperty(pht('Sprint'), $list);
     }
-
-    $view = $event->getValue('view');
-    $view->addProperty(pht('Sprint'), $list);
   }
-
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e2a75937dca90a8a12bad3ff084ea5fa9419460
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/extensions/Sprint
Gerrit-Branch: master
Gerrit-Owner: Christopher Johnson (WMDE) <[email protected]>

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

Reply via email to