@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 AlmanacInterfaceEditController
4 extends AlmanacDeviceController {
5
6 public function handleRequest(AphrontRequest $request) {
7 $viewer = $this->getViewer();
8
9 $engine = id(new AlmanacInterfaceEditEngine())
10 ->setController($this);
11
12 $id = $request->getURIData('id');
13 if (!$id) {
14 $device = id(new AlmanacDeviceQuery())
15 ->setViewer($viewer)
16 ->withIDs(array($request->getInt('deviceID')))
17 ->requireCapabilities(
18 array(
19 PhabricatorPolicyCapability::CAN_VIEW,
20 PhabricatorPolicyCapability::CAN_EDIT,
21 ))
22 ->executeOne();
23 if (!$device) {
24 return new Aphront404Response();
25 }
26
27 $engine
28 ->addContextParameter('deviceID', $device->getID())
29 ->setDevice($device);
30 }
31
32 return $engine->buildResponse();
33 }
34
35}