Differential D18412 Diff 44256 src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php
| Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | protected function execute(ConduitAPIRequest $request) { | ||||
| $xactions = array(); | $xactions = array(); | ||||
| $modular_map = array( | $modular_map = array( | ||||
| 'accept' => DifferentialRevisionAcceptTransaction::TRANSACTIONTYPE, | 'accept' => DifferentialRevisionAcceptTransaction::TRANSACTIONTYPE, | ||||
| 'reject' => DifferentialRevisionRejectTransaction::TRANSACTIONTYPE, | 'reject' => DifferentialRevisionRejectTransaction::TRANSACTIONTYPE, | ||||
| 'resign' => DifferentialRevisionResignTransaction::TRANSACTIONTYPE, | 'resign' => DifferentialRevisionResignTransaction::TRANSACTIONTYPE, | ||||
| 'request_review' => | 'request_review' => | ||||
| DifferentialRevisionRequestReviewTransaction::TRANSACTIONTYPE, | DifferentialRevisionRequestReviewTransaction::TRANSACTIONTYPE, | ||||
| 'rethink' => DifferentialRevisionPlanChangesTransaction::TRANSACTIONTYPE, | |||||
| ); | ); | ||||
| $action = $request->getValue('action'); | $action = $request->getValue('action'); | ||||
| if (isset($modular_map[$action])) { | if (isset($modular_map[$action])) { | ||||
| $xactions[] = id(new DifferentialTransaction()) | $xactions[] = id(new DifferentialTransaction()) | ||||
| ->setTransactionType($modular_map[$action]) | ->setTransactionType($modular_map[$action]) | ||||
| ->setNewValue(true); | ->setNewValue(true); | ||||
| } else if ($action) { | } else if ($action) { | ||||
| switch ($action) { | switch ($action) { | ||||
| case 'comment': | case 'comment': | ||||
| case 'none': | case 'none': | ||||
| break; | break; | ||||
| default: | default: | ||||
| $xactions[] = id(new DifferentialTransaction()) | throw new Exception( | ||||
| ->setTransactionType(DifferentialTransaction::TYPE_ACTION) | pht( | ||||
| ->setNewValue($action); | 'Unsupported action "%s".', | ||||
| $action)); | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| $content = $request->getValue('message'); | $content = $request->getValue('message'); | ||||
| if (strlen($content)) { | if (strlen($content)) { | ||||
| $xactions[] = id(new DifferentialTransaction()) | $xactions[] = id(new DifferentialTransaction()) | ||||
| ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) | ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) | ||||
| Show All 33 Lines | |||||