@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 PhrequentPopConduitAPIMethod extends PhrequentConduitAPIMethod {
4
5 public function getAPIMethodName() {
6 return 'phrequent.pop';
7 }
8
9 public function getMethodDescription() {
10 return pht('Stop tracking time on an object by popping it from the stack.');
11 }
12
13 protected function defineParamTypes() {
14 return array(
15 'objectPHID' => 'phid',
16 'stopTime' => 'int',
17 'note' => 'string',
18 );
19 }
20
21 protected function defineReturnType() {
22 return 'phid';
23 }
24
25 protected function execute(ConduitAPIRequest $request) {
26 $user = $request->getUser();
27 $object_phid = $request->getValue('objectPHID');
28 $timestamp = $request->getValue('stopTime');
29 $note = $request->getValue('note');
30 if ($timestamp === null) {
31 $timestamp = time();
32 }
33
34 $editor = new PhrequentTrackingEditor();
35
36 if (!$object_phid) {
37 return $editor->stopTrackingTop($user, $timestamp, $note);
38 } else {
39 return $editor->stopTracking($user, $object_phid, $timestamp, $note);
40 }
41 }
42
43}