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

Minor cleanup for task rendering in Daemons

Summary:
Fixes two issues:

- When rendering a task's details, we currently issue a policy-oblivious query. Instead, issue a policy-aware query.
- The formatting is a little bit weird, with the top half in a box and the bottom half with an older style. Make them consistent.

Test Plan: Looked at the detail pages for several tasks in queue.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

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

+25 -17
+12 -6
src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php
··· 41 41 $actions = $this->buildActionListView($task); 42 42 $properties = $this->buildPropertyListView($task, $actions); 43 43 44 + $object_box = id(new PHUIObjectBoxView()) 45 + ->setHeader($header) 46 + ->addPropertyList($properties); 47 + 48 + 44 49 $retry_head = id(new PHUIHeaderView()) 45 50 ->setHeader(pht('Retries')); 46 51 47 52 $retry_info = $this->buildRetryListView($task); 48 53 49 - $object_box = id(new PHUIObjectBoxView()) 50 - ->setHeader($header) 51 - ->addPropertyList($properties); 54 + $retry_box = id(new PHUIObjectBoxView()) 55 + ->setHeader($retry_head) 56 + ->addPropertyList($retry_info); 52 57 53 58 $content = array( 54 59 $object_box, 55 - $retry_head, 56 - $retry_info, 60 + $retry_box, 57 61 ); 58 62 } 59 63 ··· 117 121 private function buildPropertyListView( 118 122 PhabricatorWorkerTask $task, 119 123 PhabricatorActionListView $actions) { 124 + 125 + $viewer = $this->getRequest()->getUser(); 120 126 121 127 $view = new PHUIPropertyListView(); 122 128 $view->setActionList($actions); ··· 191 197 $data = id(new PhabricatorWorkerTaskData())->load($task->getDataID()); 192 198 $task->setData($data->getData()); 193 199 $worker = $task->getWorkerInstance(); 194 - $data = $worker->renderForDisplay(); 200 + $data = $worker->renderForDisplay($viewer); 195 201 196 202 $view->addProperty( 197 203 pht('Data'),
+1 -1
src/applications/metamta/PhabricatorMetaMTAWorker.php
··· 41 41 return $this->message; 42 42 } 43 43 44 - public function renderForDisplay() { 44 + public function renderForDisplay(PhabricatorUser $viewer) { 45 45 return phutil_tag( 46 46 'pre', 47 47 array(
+11 -9
src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php
··· 64 64 return (bool)$bad_commit; 65 65 } 66 66 67 - public function renderForDisplay() { 68 - $suffix = parent::renderForDisplay(); 69 - $commit = $this->loadCommit(); 67 + public function renderForDisplay(PhabricatorUser $viewer) { 68 + $suffix = parent::renderForDisplay($viewer); 69 + 70 + $commit = id(new DiffusionCommitQuery()) 71 + ->setViewer($viewer) 72 + ->withIDs(array(idx($this->getTaskData(), 'commitID'))) 73 + ->executeOne(); 70 74 if (!$commit) { 71 75 return $suffix; 72 76 } 73 77 74 - // TODO: (T603) This method should probably take a viewer. 78 + $link = DiffusionView::linkCommit( 79 + $commit->getRepository(), 80 + $commit->getCommitIdentifier()); 75 81 76 - $repository = id(new PhabricatorRepository()) 77 - ->load($commit->getRepositoryID()); 78 - $link = DiffusionView::linkCommit($repository, 79 - $commit->getCommitIdentifier()); 80 - return hsprintf('%s%s', $link, $suffix); 82 + return array($link, $suffix); 81 83 } 82 84 }
+1 -1
src/infrastructure/daemon/workers/PhabricatorWorker.php
··· 154 154 } 155 155 } 156 156 157 - public function renderForDisplay() { 157 + public function renderForDisplay(PhabricatorUser $viewer) { 158 158 $data = PhutilReadableSerializer::printableValue($this->data); 159 159 return phutil_tag('pre', array(), $data); 160 160 }