Make PhabricatorActionListView logged-out user savvy

Summary:
Fixes T2691. Now, all PhabricatorActionListViews in the codebase setObjectHref to $request->getRequestURI. This value is passed over to PhabricatorActionItems right before they are rendered. If a PhabricatorActionItem is a workflow and there is no user OR the user is logged out, we used this objectURI to construct a log in URI.

Potentially added some undesirable behavior to aggressively setUser (and later setObjectURI) from within the List on Actions... This should be okay-ish unless there was a vision of actions having different user objects associated with them. I think this is a safe assumption.

Test Plan: played around with a mock all logged out (Ref T2652) and it worked!

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2691

Differential Revision: https://secure.phabricator.com/D6416
This commit is contained in:
Bob Trahan
2013-07-12 11:39:47 -07:00
parent b6df427c2f
commit 9838251515
30 changed files with 90 additions and 37 deletions

View File

@@ -378,6 +378,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
return id(new PhabricatorActionListView())
->setUser($user)
->setObjectURI($this->getRequest()->getRequestURI())
->addAction($blame_button)
->addAction($highlight_button)
->addAction($lint_button)
@@ -821,6 +822,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
$actions = id(new PhabricatorActionListView())
->setUser($this->getRequest()->getUser())
->setObjectURI($this->getRequest()->getRequestURI())
->addAction($this->createEditAction());
return array($actions, $properties);
@@ -837,6 +839,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
$actions = id(new PhabricatorActionListView())
->setUser($this->getRequest()->getUser())
->setObjectURI($this->getRequest()->getRequestURI())
->addAction($this->createEditAction())
->addAction(
id(new PhabricatorActionView())

View File

@@ -860,7 +860,8 @@ final class DiffusionCommitController extends DiffusionController {
$actions = id(new PhabricatorActionListView())
->setUser($user)
->setObject($commit);
->setObject($commit)
->setObjectURI($request->getRequestURI());
// TODO -- integrate permissions into whether or not this action is shown
$uri = '/diffusion/'.$repository->getCallSign().'/commit/'.

View File

@@ -70,6 +70,7 @@ final class DiffusionRepositoryEditController extends DiffusionController {
$user = $this->getRequest()->getUser();
$view = id(new PhabricatorActionListView())
->setObjectURI($this->getRequest()->getRequestURI())
->setUser($user);
$can_edit = PhabricatorPolicyFilter::hasCapability(
@@ -122,6 +123,7 @@ final class DiffusionRepositoryEditController extends DiffusionController {
$user = $this->getRequest()->getUser();
$view = id(new PhabricatorActionListView())
->setObjectURI($this->getRequest()->getRequestURI())
->setUser($user);
$can_edit = PhabricatorPolicyFilter::hasCapability(