1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Fix a fatal when viewing a daemon task with an invalid ID

Summary:
Fixes T11295. Prior to this change, the "404 page" for daemon tasks fatals.

This page is special cased a little bit and not a normal 404 page, because it's possible for you to click a valid link and the task to get GC'd by the time you load the page, or similar. It tries to be a little more user-friendly than a bare 404.

Test Plan:
  - Visited `/daemon/task/1428348920328/` (any invalid ID).
  - Now got a nice "no such task" page.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11295

Differential Revision: https://secure.phabricator.com/D16254
This commit is contained in:
epriestley 2016-07-08 04:31:41 -07:00
parent c5efb453be
commit 1c088822b4

View file

@ -15,9 +15,13 @@ final class PhabricatorWorkerTaskDetailController
$task = reset($tasks);
}
$header = new PHUIHeaderView();
if (!$task) {
$title = pht('Task Does Not Exist');
$header->setHeader(pht('Task %d Missing', $id));
$error_view = new PHUIInfoView();
$error_view->setTitle(pht('No Such Task'));
$error_view->appendChild(phutil_tag(
@ -30,11 +34,11 @@ final class PhabricatorWorkerTaskDetailController
} else {
$title = pht('Task %d', $task->getID());
$header = id(new PHUIHeaderView())
->setHeader(pht('Task %d: %s',
$header->setHeader(
pht(
'Task %d: %s',
$task->getID(),
$task->getTaskClass()))
->setHeaderIcon('fa-sort');
$task->getTaskClass()));
$properties = $this->buildPropertyListView($task);
@ -59,6 +63,8 @@ final class PhabricatorWorkerTaskDetailController
);
}
$header->setHeaderIcon('fa-sort');
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title);
$crumbs->setBorder(true);