@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 ConpherenceCreateThreadConduitAPIMethod
4 extends ConpherenceConduitAPIMethod {
5
6 public function getAPIMethodName() {
7 return 'conpherence.createthread';
8 }
9
10 public function getMethodDescription() {
11 return pht('Create a new conpherence thread.');
12 }
13
14 public function getMethodStatus() {
15 return self::METHOD_STATUS_DEPRECATED;
16 }
17
18 public function getMethodStatusDescription() {
19 return pht(
20 'This method has been deprecated since %s in favor of %s.',
21 '10/2025',
22 'conpherence.edit');
23 }
24
25 protected function defineParamTypes() {
26 return array(
27 'title' => 'required string',
28 'topic' => 'optional string',
29 'message' => 'optional string',
30 'participantPHIDs' => 'required list<phids>',
31 );
32 }
33
34 protected function defineReturnType() {
35 return 'nonempty dict';
36 }
37
38 protected function defineErrorTypes() {
39 return array(
40 'ERR_EMPTY_PARTICIPANT_PHIDS' => pht(
41 'You must specify participant phids.'),
42 'ERR_EMPTY_TITLE' => pht(
43 'You must specify a title.'),
44 );
45 }
46
47 protected function execute(ConduitAPIRequest $request) {
48 $participant_phids = $request->getValue('participantPHIDs', array());
49 $message = $request->getValue('message');
50 $title = $request->getValue('title');
51 $topic = $request->getValue('topic');
52
53 list($errors, $conpherence) = ConpherenceEditor::createThread(
54 $request->getUser(),
55 $participant_phids,
56 $title,
57 $message,
58 $request->newContentSource(),
59 $topic);
60
61 if ($errors) {
62 foreach ($errors as $error_code) {
63 switch ($error_code) {
64 case ConpherenceEditor::ERROR_EMPTY_PARTICIPANTS:
65 throw new ConduitException('ERR_EMPTY_PARTICIPANT_PHIDS');
66 }
67 }
68 }
69
70 return array(
71 'conpherenceID' => $conpherence->getID(),
72 'conpherencePHID' => $conpherence->getPHID(),
73 'conpherenceURI' => $this->getConpherenceURI($conpherence),
74 );
75 }
76
77}