@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Render revision and audit state icons in Maniphest

Summary:
Fixes T7076. This could probably use some tweaking but should get the basics in place.

This shows overall object state (e.g., "Needs Review"), not individual viewer state (e.g., "you need to review this"). After the bucketing changes it seems like we're mostly in a reasonable place on showing global state instead of viewer state. This makes the overall change much easier than it might otherwise have been.

Test Plan: {F2351867}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T7076

Differential Revision: https://secure.phabricator.com/D17193

+123 -10
+18 -4
src/applications/differential/phid/DifferentialRevisionPHIDType.php
··· 33 33 $revision = $objects[$phid]; 34 34 35 35 $title = $revision->getTitle(); 36 - $id = $revision->getID(); 37 36 $status = $revision->getStatus(); 37 + $monogram = $revision->getMonogram(); 38 + $uri = $revision->getURI(); 38 39 39 - $handle->setName("D{$id}"); 40 - $handle->setURI("/D{$id}"); 41 - $handle->setFullName("D{$id}: {$title}"); 40 + $handle 41 + ->setName($monogram) 42 + ->setURI($uri) 43 + ->setFullName("{$monogram}: {$title}"); 42 44 43 45 if ($revision->isClosed()) { 44 46 $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); 45 47 } 48 + 49 + $status = $revision->getStatus(); 50 + 51 + $icon = DifferentialRevisionStatus::getRevisionStatusIcon($status); 52 + $color = DifferentialRevisionStatus::getRevisionStatusColor($status); 53 + $name = ArcanistDifferentialRevisionStatus::getNameForRevisionStatus( 54 + $status); 55 + 56 + $handle 57 + ->setStateIcon($icon) 58 + ->setStateColor($color) 59 + ->setStateName($name); 46 60 } 47 61 } 48 62
+11 -6
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 397 397 398 398 foreach ($commit_phids as $phid) { 399 399 $revisions_commits[$phid] = $handles->renderHandle($phid) 400 - ->setShowHovercard(true); 400 + ->setShowHovercard(true) 401 + ->setShowStateIcon(true); 401 402 $revision_phid = key($drev_edges[$phid][$commit_drev]); 402 403 $revision_handle = $handles->getHandleIfExists($revision_phid); 403 404 if ($revision_handle) { ··· 412 413 } 413 414 414 415 foreach ($edge_types as $edge_type => $edge_name) { 415 - if ($edges[$edge_type]) { 416 - $edge_handles = $viewer->loadHandles(array_keys($edges[$edge_type])); 417 - $view->addProperty( 418 - $edge_name, 419 - $edge_handles->renderList()); 416 + if (!$edges[$edge_type]) { 417 + continue; 420 418 } 419 + 420 + $edge_handles = $viewer->loadHandles(array_keys($edges[$edge_type])); 421 + 422 + $edge_list = $edge_handles->renderList() 423 + ->setShowStateIcons(true); 424 + 425 + $view->addProperty($edge_name, $edge_list); 421 426 } 422 427 423 428 if ($revisions_commits) {
+52
src/applications/phid/PhabricatorObjectHandle.php
··· 31 31 private $tokenIcon; 32 32 private $commandLineObjectName; 33 33 34 + private $stateIcon; 35 + private $stateColor; 36 + private $stateName; 37 + 34 38 public function setIcon($icon) { 35 39 $this->icon = $icon; 36 40 return $this; ··· 284 288 return $this->complete; 285 289 } 286 290 291 + public function setStateIcon($state_icon) { 292 + $this->stateIcon = $state_icon; 293 + return $this; 294 + } 295 + 296 + public function getStateIcon() { 297 + return $this->stateIcon; 298 + } 299 + 300 + public function setStateColor($state_color) { 301 + $this->stateColor = $state_color; 302 + return $this; 303 + } 304 + 305 + public function getStateColor() { 306 + return $this->stateColor; 307 + } 308 + 309 + public function setStateName($state_name) { 310 + $this->stateName = $state_name; 311 + return $this; 312 + } 313 + 314 + public function getStateName() { 315 + return $this->stateName; 316 + } 317 + 318 + public function renderStateIcon() { 319 + $icon = $this->getStateIcon(); 320 + if ($icon === null) { 321 + $icon = 'fa-question-circle-o'; 322 + } 323 + 324 + $color = $this->getStateColor(); 325 + 326 + $name = $this->getStateName(); 327 + if ($name === null) { 328 + $name = pht('Unknown'); 329 + } 330 + 331 + return id(new PHUIIconView()) 332 + ->setIcon($icon, $color) 333 + ->addSigil('has-tooltip') 334 + ->setMetadata( 335 + array( 336 + 'tip' => $name, 337 + )); 338 + } 287 339 288 340 public function renderLink($name = null) { 289 341 return $this->renderLinkWithAttributes($name, array());
+17
src/applications/phid/view/PHUIHandleListView.php
··· 13 13 private $handleList; 14 14 private $asInline; 15 15 private $asText; 16 + private $showStateIcons; 16 17 17 18 public function setHandleList(PhabricatorHandleList $list) { 18 19 $this->handleList = $list; ··· 37 38 return $this->asText; 38 39 } 39 40 41 + public function setShowStateIcons($show_state_icons) { 42 + $this->showStateIcons = $show_state_icons; 43 + return $this; 44 + } 45 + 46 + public function getShowStateIcons() { 47 + return $this->showStateIcons; 48 + } 49 + 40 50 protected function getTagName() { 41 51 if ($this->getAsText()) { 42 52 return null; ··· 49 59 50 60 protected function getTagContent() { 51 61 $list = $this->handleList; 62 + 63 + $show_state_icons = $this->getShowStateIcons(); 64 + 52 65 $items = array(); 53 66 foreach ($list as $handle) { 54 67 $view = $list->renderHandle($handle->getPHID()) 55 68 ->setShowHovercard(true) 56 69 ->setAsText($this->getAsText()); 70 + 71 + if ($show_state_icons) { 72 + $view->setShowStateIcon(true); 73 + } 57 74 58 75 $items[] = $view; 59 76 }
+15
src/applications/phid/view/PHUIHandleView.php
··· 17 17 private $asText; 18 18 private $useShortName; 19 19 private $showHovercard; 20 + private $showStateIcon; 20 21 21 22 public function setHandleList(PhabricatorHandleList $list) { 22 23 $this->handleList = $list; ··· 48 49 return $this; 49 50 } 50 51 52 + public function setShowStateIcon($show_state_icon) { 53 + $this->showStateIcon = $show_state_icon; 54 + return $this; 55 + } 56 + 57 + public function getShowStateIcon() { 58 + return $this->showStateIcon; 59 + } 60 + 51 61 public function render() { 52 62 $handle = $this->handleList[$this->handlePHID]; 53 63 ··· 75 85 $link = $handle->renderHovercardLink($name); 76 86 } else { 77 87 $link = $handle->renderLink($name); 88 + } 89 + 90 + if ($this->showStateIcon) { 91 + $icon = $handle->renderStateIcon(); 92 + $link = array($icon, ' ', $link); 78 93 } 79 94 80 95 return $link;
+10
src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php
··· 81 81 $handle->setFullName($full_name); 82 82 $handle->setURI($commit->getURI()); 83 83 $handle->setTimestamp($commit->getEpoch()); 84 + 85 + $status = $commit->getAuditStatus(); 86 + $icon = PhabricatorAuditCommitStatusConstants::getStatusIcon($status); 87 + $color = PhabricatorAuditCommitStatusConstants::getStatusColor($status); 88 + $name = PhabricatorAuditCommitStatusConstants::getStatusName($status); 89 + 90 + $handle 91 + ->setStateIcon($icon) 92 + ->setStateColor($color) 93 + ->setStateName($name); 84 94 } 85 95 } 86 96