Differential D21812 Diff 52021 src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | public function applyEdit( | ||||
$comment->setContentSource($this->getContentSource()); | $comment->setContentSource($this->getContentSource()); | ||||
$comment->setAuthorPHID($this->getActingAsPHID()); | $comment->setAuthorPHID($this->getActingAsPHID()); | ||||
// TODO: This needs to be more sophisticated once we have meta-policies. | // TODO: This needs to be more sophisticated once we have meta-policies. | ||||
$comment->setViewPolicy(PhabricatorPolicies::POLICY_PUBLIC); | $comment->setViewPolicy(PhabricatorPolicies::POLICY_PUBLIC); | ||||
$comment->setEditPolicy($this->getActingAsPHID()); | $comment->setEditPolicy($this->getActingAsPHID()); | ||||
$file_phids = PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles( | |||||
$actor, | |||||
array( | |||||
$comment->getContent(), | |||||
)); | |||||
$xaction->openTransaction(); | $xaction->openTransaction(); | ||||
$xaction->beginReadLocking(); | $xaction->beginReadLocking(); | ||||
if ($xaction->getID()) { | if ($xaction->getID()) { | ||||
$xaction->reload(); | $xaction->reload(); | ||||
} | } | ||||
$new_version = $xaction->getCommentVersion() + 1; | $new_version = $xaction->getCommentVersion() + 1; | ||||
Show All 32 Lines | $xaction->openTransaction(); | ||||
->setContinueOnMissingFields(true) | ->setContinueOnMissingFields(true) | ||||
->applyTransactions($object, $support_xactions); | ->applyTransactions($object, $support_xactions); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$xaction->endReadLocking(); | $xaction->endReadLocking(); | ||||
$xaction->saveTransaction(); | $xaction->saveTransaction(); | ||||
// Add links to any files newly referenced by the edit. | |||||
if ($file_phids) { | |||||
$editor = new PhabricatorEdgeEditor(); | |||||
foreach ($file_phids as $file_phid) { | |||||
$editor->addEdge( | |||||
$xaction->getObjectPHID(), | |||||
PhabricatorObjectHasFileEdgeType::EDGECONST , | |||||
$file_phid); | |||||
} | |||||
$editor->save(); | |||||
} | |||||
return $this; | return $this; | ||||
} | } | ||||
/** | /** | ||||
* Validate that the edit is permissible, and the actor has permission to | * Validate that the edit is permissible, and the actor has permission to | ||||
* perform it. | * perform it. | ||||
*/ | */ | ||||
private function validateEdit( | private function validateEdit( | ||||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |