@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
3abstract class PhabricatorApplicationTransactionController
4 extends PhabricatorController {
5
6 protected function guessCancelURI(
7 PhabricatorUser $viewer,
8 PhabricatorApplicationTransaction $xaction) {
9
10 // Take an educated guess at the URI where the transactions appear so we
11 // can send the cancel button somewhere sensible. This won't always get the
12 // best answer (for example, Diffusion's history is visible on a page other
13 // than the main object view page) but should always get a reasonable one.
14
15 $cancel_uri = '/';
16 $handle = id(new PhabricatorHandleQuery())
17 ->setViewer($viewer)
18 ->withPHIDs(array($xaction->getObjectPHID()))
19 ->executeOne();
20 if ($handle) {
21 $cancel_uri = $handle->getURI();
22 }
23
24 return $cancel_uri;
25 }
26
27}