@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.

Streamline tag rendering for Differential and Maniphest

Summary:
Well, I'm just putting it into the DAO classes, or am I doing something wrong?

Will be used by future event listeners

Test Plan: Visited some tasks and revisions. Look fine.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

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

authored by

Anh Nhan Nguyen and committed by
epriestley
4c6ab506 8270b0e9

+23 -16
+11 -6
src/applications/differential/view/DifferentialRevisionDetailView.php
··· 110 110 111 111 private function renderHeader(DifferentialRevision $revision) { 112 112 $view = id(new PhabricatorHeaderView()) 113 - ->setHeader($revision->getTitle()); 113 + ->setHeader($revision->getTitle($revision)); 114 + 115 + $view->addTag(self::renderTagForRevision($revision)); 116 + 117 + return $view; 118 + } 119 + 120 + public static function renderTagForRevision( 121 + DifferentialRevision $revision) { 114 122 115 123 $status = $revision->getStatus(); 116 124 $status_name = ··· 118 126 $status_color = 119 127 DifferentialRevisionStatus::getRevisionStatusTagColor($status); 120 128 121 - $view->addTag( 122 - id(new PhabricatorTagView()) 129 + return id(new PhabricatorTagView()) 123 130 ->setType(PhabricatorTagView::TYPE_STATE) 124 131 ->setName($status_name) 125 - ->setBackgroundColor($status_color)); 126 - 127 - return $view; 132 + ->setBackgroundColor($status_color); 128 133 } 129 134 }
+1 -9
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 374 374 $view = id(new PhabricatorHeaderView()) 375 375 ->setHeader($task->getTitle()); 376 376 377 - $status = $task->getStatus(); 378 - $status_name = ManiphestTaskStatus::getTaskStatusFullName($status); 379 - $status_color = ManiphestTaskStatus::getTaskStatusTagColor($status); 380 - 381 - $view->addTag( 382 - id(new PhabricatorTagView()) 383 - ->setType(PhabricatorTagView::TYPE_STATE) 384 - ->setName($status_name) 385 - ->setBackgroundColor($status_color)); 377 + $view->addTag(ManiphestView::renderTagForTask($task)); 386 378 387 379 return $view; 388 380 }
-1
src/applications/maniphest/storage/ManiphestTask.php
··· 144 144 return $this; 145 145 } 146 146 147 - 148 147 public function save() { 149 148 if (!$this->mailKey) { 150 149 $this->mailKey = Filesystem::readRandomCharacters(20);
+11
src/applications/maniphest/view/ManiphestView.php
··· 5 5 */ 6 6 abstract class ManiphestView extends AphrontView { 7 7 8 + public static function renderTagForTask(ManiphestTask $task) { 9 + $status = $task->getStatus(); 10 + $status_name = ManiphestTaskStatus::getTaskStatusFullName($status); 11 + $status_color = ManiphestTaskStatus::getTaskStatusTagColor($status); 12 + 13 + return id(new PhabricatorTagView()) 14 + ->setType(PhabricatorTagView::TYPE_STATE) 15 + ->setName($status_name) 16 + ->setBackgroundColor($status_color); 17 + } 18 + 8 19 }