mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-03 20:22:46 +01:00
601aaa5a86
Summary: Ref T10537. For Nuance, I want to introduce new sources (like "GitHub" or "GitHub via Nuance" or something) but this needs to modularize eventually. Split ContentSource apart so applications can add new content sources. Test Plan: This change has huge surface area, so I'll hold it until post-release. I think it's fairly safe (and if it does break anything, the breaks should be fatals, not anything subtle or difficult to fix), there's just no reason not to hold it for a few hours. - Viewed new module page. - Grepped for all removed functions/constants. - Viewed some transactions. - Hovered over timestamps to get content source details. - Added a comment via Conduit. - Added a comment via web. - Ran `bin/storage upgrade --namespace XXXXX --no-quickstart -f` to re-run all historic migrations. - Generated some objects with `bin/lipsum`. - Ran a bulk job on some tasks. - Ran unit tests. {F1190182} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10537 Differential Revision: https://secure.phabricator.com/D15521
67 lines
1.8 KiB
PHP
67 lines
1.8 KiB
PHP
<?php
|
|
|
|
final class ConpherenceCreateThreadConduitAPIMethod
|
|
extends ConpherenceConduitAPIMethod {
|
|
|
|
public function getAPIMethodName() {
|
|
return 'conpherence.createthread';
|
|
}
|
|
|
|
public function getMethodDescription() {
|
|
return pht('Create a new conpherence thread.');
|
|
}
|
|
|
|
protected function defineParamTypes() {
|
|
return array(
|
|
'title' => 'optional string',
|
|
'message' => 'required string',
|
|
'participantPHIDs' => 'required list<phids>',
|
|
);
|
|
}
|
|
|
|
protected function defineReturnType() {
|
|
return 'nonempty dict';
|
|
}
|
|
|
|
protected function defineErrorTypes() {
|
|
return array(
|
|
'ERR_EMPTY_PARTICIPANT_PHIDS' => pht(
|
|
'You must specify participant phids.'),
|
|
'ERR_EMPTY_MESSAGE' => pht(
|
|
'You must specify a message.'),
|
|
);
|
|
}
|
|
|
|
protected function execute(ConduitAPIRequest $request) {
|
|
$participant_phids = $request->getValue('participantPHIDs', array());
|
|
$message = $request->getValue('message');
|
|
$title = $request->getValue('title');
|
|
|
|
list($errors, $conpherence) = ConpherenceEditor::createThread(
|
|
$request->getUser(),
|
|
$participant_phids,
|
|
$title,
|
|
$message,
|
|
$request->newContentSource());
|
|
|
|
if ($errors) {
|
|
foreach ($errors as $error_code) {
|
|
switch ($error_code) {
|
|
case ConpherenceEditor::ERROR_EMPTY_MESSAGE:
|
|
throw new ConduitException('ERR_EMPTY_MESSAGE');
|
|
break;
|
|
case ConpherenceEditor::ERROR_EMPTY_PARTICIPANTS:
|
|
throw new ConduitException('ERR_EMPTY_PARTICIPANT_PHIDS');
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return array(
|
|
'conpherenceID' => $conpherence->getID(),
|
|
'conpherencePHID' => $conpherence->getPHID(),
|
|
'conpherenceURI' => $this->getConpherenceURI($conpherence),
|
|
);
|
|
}
|
|
|
|
}
|