Make AphrontProxyResponse reduce to a real response instead of building a string
Summary: Currently, AphrontProxyResponse is expected to build a string. This prevents some response types (like Dialog) from being proxied, because they have special rules. Instead, make proxy responses reduce into a non-proxied response so it's possible to proxy any type of response and hit all the normal rules for it. Test Plan: Built a proxied DialogResponse on top of this. Reviewers: btrahan, vrana Reviewed By: btrahan CC: aran Maniphest Tasks: T2104, T912 Differential Revision: https://secure.phabricator.com/D4159
This commit is contained in:
@@ -181,6 +181,22 @@ abstract class PhabricatorController extends AphrontController {
|
||||
public function didProcessRequest($response) {
|
||||
$request = $this->getRequest();
|
||||
$response->setRequest($request);
|
||||
|
||||
$seen = array();
|
||||
while ($response instanceof AphrontProxyResponse) {
|
||||
|
||||
$hash = spl_object_hash($response);
|
||||
if (isset($seen[$hash])) {
|
||||
$seen[] = get_class($response);
|
||||
throw new Exception(
|
||||
"Cycle while reducing proxy responses: ".
|
||||
implode(' -> ', $seen));
|
||||
}
|
||||
$seen[$hash] = get_class($response);
|
||||
|
||||
$response = $response->reduceProxyResponse();
|
||||
}
|
||||
|
||||
if ($response instanceof AphrontDialogResponse) {
|
||||
if (!$request->isAjax()) {
|
||||
$view = new PhabricatorStandardPageView();
|
||||
|
||||
Reference in New Issue
Block a user