mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-29 08:50:58 +01:00
9838251515
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
67 lines
1.4 KiB
PHP
67 lines
1.4 KiB
PHP
<?php
|
|
|
|
final class PhabricatorActionListView extends AphrontView {
|
|
|
|
private $actions = array();
|
|
private $object;
|
|
private $objectURI;
|
|
private $id = null;
|
|
|
|
public function setObject(PhabricatorLiskDAO $object) {
|
|
$this->object = $object;
|
|
return $this;
|
|
}
|
|
|
|
public function setObjectURI($uri) {
|
|
$this->objectURI = $uri;
|
|
return $this;
|
|
}
|
|
|
|
public function addAction(PhabricatorActionView $view) {
|
|
$this->actions[] = $view;
|
|
return $this;
|
|
}
|
|
|
|
public function setID($id) {
|
|
$this->id = $id;
|
|
return $this;
|
|
}
|
|
|
|
public function render() {
|
|
if (!$this->user) {
|
|
throw new Exception(pht("Call setUser() before render()!"));
|
|
}
|
|
|
|
$event = new PhabricatorEvent(
|
|
PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS,
|
|
array(
|
|
'object' => $this->object,
|
|
'actions' => $this->actions,
|
|
));
|
|
$event->setUser($this->user);
|
|
PhutilEventEngine::dispatchEvent($event);
|
|
|
|
$actions = $event->getValue('actions');
|
|
|
|
if (!$actions) {
|
|
return null;
|
|
}
|
|
|
|
foreach ($actions as $action) {
|
|
$action->setObjectURI($this->objectURI);
|
|
$action->setUser($this->user);
|
|
}
|
|
|
|
require_celerity_resource('phabricator-action-list-view-css');
|
|
|
|
return phutil_tag(
|
|
'ul',
|
|
array(
|
|
'class' => 'phabricator-action-list-view',
|
|
'id' => $this->id
|
|
),
|
|
$actions);
|
|
}
|
|
|
|
|
|
}
|