Changeset View
Changeset View
Standalone View
Standalone View
src/applications/paste/conduit/PasteCreateConduitAPIMethod.php
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | protected function execute(ConduitAPIRequest $request) { | ||||
$viewer = $request->getUser(); | $viewer = $request->getUser(); | ||||
$paste = PhabricatorPaste::initializeNewPaste($viewer); | $paste = PhabricatorPaste::initializeNewPaste($viewer); | ||||
$xactions = array(); | $xactions = array(); | ||||
$xactions[] = id(new PhabricatorPasteTransaction()) | $xactions[] = id(new PhabricatorPasteTransaction()) | ||||
->setTransactionType(PhabricatorPasteTransaction::TYPE_CONTENT) | ->setTransactionType(PhabricatorPasteContentTransaction::TRANSACTIONTYPE) | ||||
->setNewValue($content); | ->setNewValue($content); | ||||
$xactions[] = id(new PhabricatorPasteTransaction()) | $xactions[] = id(new PhabricatorPasteTransaction()) | ||||
->setTransactionType(PhabricatorPasteTransaction::TYPE_TITLE) | ->setTransactionType(PhabricatorPasteTitleTransaction::TRANSACTIONTYPE) | ||||
->setNewValue($title); | ->setNewValue($title); | ||||
$xactions[] = id(new PhabricatorPasteTransaction()) | $xactions[] = id(new PhabricatorPasteTransaction()) | ||||
->setTransactionType(PhabricatorPasteTransaction::TYPE_LANGUAGE) | ->setTransactionType(PhabricatorPasteLanguageTransaction::TRANSACTIONTYPE) | ||||
->setNewValue($language); | ->setNewValue($language); | ||||
$editor = id(new PhabricatorPasteEditor()) | $editor = id(new PhabricatorPasteEditor()) | ||||
->setActor($viewer) | ->setActor($viewer) | ||||
->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true) | ||||
->setContentSource($request->newContentSource()); | ->setContentSource($request->newContentSource()); | ||||
$xactions = $editor->applyTransactions($paste, $xactions); | $xactions = $editor->applyTransactions($paste, $xactions); | ||||
$paste->attachRawContent($content); | $paste->attachRawContent($content); | ||||
return $this->buildPasteInfoDictionary($paste); | return $this->buildPasteInfoDictionary($paste); | ||||
} | } | ||||
} | } |