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:
parent
92c4dfdfb1
commit
98615c3540
1 changed files with 14 additions and 5 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue