@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorApplicationTransactionValidationResponse
4 extends AphrontProxyResponse {
5
6 private $viewer;
7 private $exception;
8 private $cancelURI;
9
10 public function setCancelURI($cancel_uri) {
11 $this->cancelURI = $cancel_uri;
12 return $this;
13 }
14
15 public function setException(
16 PhabricatorApplicationTransactionValidationException $exception) {
17 $this->exception = $exception;
18 return $this;
19 }
20
21 protected function buildProxy() {
22 return new AphrontDialogResponse();
23 }
24
25 public function reduceProxyResponse() {
26 $request = $this->getRequest();
27
28 $ex = $this->exception;
29 $title = pht('Validation Errors');
30
31 $dialog = id(new AphrontDialogView())
32 ->setUser($request->getUser())
33 ->setTitle($title);
34
35 $list = array();
36 foreach ($ex->getErrors() as $error) {
37 $list[] = $error->getMessage();
38 }
39
40 $dialog->appendList($list);
41 $dialog->addCancelButton($this->cancelURI);
42
43 return $this->getProxy()->setDialog($dialog);
44 }
45
46}