1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00

Fix Phriction rendering for initial install and 404 pages

Summary:
Depends on D19682. Ref T13202. We currently fatal when trying to render a timeline if:

  - an install is fresh, so there are no pages yet, and you look at "/w/"; or
  - you're looking at a Phriction page which doesn't exist (yet) like "/w/aadsflknadsflnf/".

Rendering a timeline and comment area doesn't make sense in these cases, so don't render them.

Test Plan: Hit both cases described above, got "new/empty page" prompts instead of fatals.

Reviewers: amckinley

Maniphest Tasks: T13202

Differential Revision: https://secure.phabricator.com/D19683
This commit is contained in:
epriestley 2018-09-17 15:16:00 -07:00
parent e5c6a5749a
commit 5ba66e56fd

View file

@ -377,16 +377,21 @@ final class PhrictionDocumentController
$page_content->setCurtain($curtain); $page_content->setCurtain($curtain);
} }
$timeline = $this->buildTransactionTimeline( if ($document->getPHID()) {
$document, $timeline = $this->buildTransactionTimeline(
new PhrictionTransactionQuery()); $document,
new PhrictionTransactionQuery());
$edit_engine = id(new PhrictionDocumentEditEngine()) $edit_engine = id(new PhrictionDocumentEditEngine())
->setViewer($viewer) ->setViewer($viewer)
->setTargetObject($document); ->setTargetObject($document);
$comment_view = $edit_engine $comment_view = $edit_engine
->buildEditEngineCommentView($document); ->buildEditEngineCommentView($document);
} else {
$timeline = null;
$comment_view = null;
}
return $this->newPage() return $this->newPage()
->setTitle($page_title) ->setTitle($page_title)