Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php
Show All 35 Lines | $doc = id(new PhrictionDocumentQuery()) | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
)) | )) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$doc) { | if (!$doc) { | ||||
throw new Exception(pht('No such document.')); | throw new Exception(pht('No such document.')); | ||||
} | } | ||||
$xactions = array(); | $xactions = array(); | ||||
if ($request->getValue('title')) { | |||||
$xactions[] = id(new PhrictionTransaction()) | $xactions[] = id(new PhrictionTransaction()) | ||||
->setTransactionType(PhrictionDocumentTitleTransaction::TRANSACTIONTYPE) | ->setTransactionType( | ||||
PhrictionDocumentTitleTransaction::TRANSACTIONTYPE) | |||||
->setNewValue($request->getValue('title')); | ->setNewValue($request->getValue('title')); | ||||
} | |||||
if ($request->getValue('content')) { | |||||
$xactions[] = id(new PhrictionTransaction()) | $xactions[] = id(new PhrictionTransaction()) | ||||
->setTransactionType(PhrictionDocumentContentTransaction::TRANSACTIONTYPE) | ->setTransactionType( | ||||
PhrictionDocumentContentTransaction::TRANSACTIONTYPE) | |||||
->setNewValue($request->getValue('content')); | ->setNewValue($request->getValue('content')); | ||||
} | |||||
$editor = id(new PhrictionTransactionEditor()) | $editor = id(new PhrictionTransactionEditor()) | ||||
->setActor($request->getUser()) | ->setActor($request->getUser()) | ||||
->setContentSource($request->newContentSource()) | ->setContentSource($request->newContentSource()) | ||||
->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true) | ||||
->setDescription((string)$request->getValue('description')); | ->setDescription((string)$request->getValue('description')); | ||||
try { | try { | ||||
Show All 10 Lines |