1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 13:52:40 +01:00

Phriction Action View won't render weird actions when document does not exist

Summary:
The actions wouldn't behave as I want. Disabled them and display "Create Document" instead, since the others make no sense on a non-existing page.

The linking was error-prone btw. `/phriction/edit//` (how it and others would be linked) wouldn't route to anything, and even if, would result in an error anyway since non-existing docs can't be deleted nor have their history shown.

Test Plan:
verified buttons disappeard when document was not created.

verified at least history button would appear when document existed, but was deleted (should work for move, too)

Reviewers: epriestley, chad, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2384

Differential Revision: https://secure.phabricator.com/D5203
This commit is contained in:
Anh Nhan Nguyen 2013-03-04 07:21:47 -08:00 committed by epriestley
parent 92c4dfdfb1
commit 98615c3540

View file

@ -196,12 +196,21 @@ final class PhrictionDocumentController
$action_view = id(new PhabricatorActionListView())
->setUser($user)
->setObject($document)
->addAction(
->setObject($document);
if (!$document->getID()) {
return $action_view->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Document'))
->setIcon('edit')
->setHref('/phriction/edit/'.$document->getID().'/'));
->setName(pht('Create this document'))
->setIcon('create')
->setHref('/phriction/edit/?slug='.$slug));
}
$action_view->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Document'))
->setIcon('edit')
->setHref('/phriction/edit/'.$document->getID().'/'));
if ($document->getStatus() == PhrictionDocumentStatus::STATUS_EXISTS) {
$action_view->addAction(