Differential D20551 Diff 49035 src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRemoveController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRemoveController.php
Show All 26 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$obj_phid = $xaction->getObjectPHID(); | $obj_phid = $xaction->getObjectPHID(); | ||||
$obj_handle = id(new PhabricatorHandleQuery()) | $obj_handle = id(new PhabricatorHandleQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withPHIDs(array($obj_phid)) | ->withPHIDs(array($obj_phid)) | ||||
->executeOne(); | ->executeOne(); | ||||
$done_uri = $obj_handle->getURI(); | $done_uri = $obj_handle->getURI(); | ||||
// We allow administrative removal of comments even if an object is locked, | |||||
// so you can lock a flamewar and then go clean it up. Locked threads may | |||||
// not otherwise be edited, and non-administrators can not remove comments | |||||
// from locked threads. | |||||
$object = $xaction->getObject(); | |||||
$can_interact = PhabricatorPolicyFilter::hasCapability( | |||||
$viewer, | |||||
$object, | |||||
PhabricatorPolicyCapability::CAN_INTERACT); | |||||
if (!$can_interact && !$viewer->getIsAdmin()) { | |||||
return $this->newDialog() | |||||
->setTitle(pht('Conversation Locked')) | |||||
->appendParagraph( | |||||
pht( | |||||
'You can not remove this comment because the conversation is '. | |||||
'locked.')) | |||||
->addCancelButton($done_uri); | |||||
} | |||||
if ($request->isFormOrHisecPost()) { | if ($request->isFormOrHisecPost()) { | ||||
$comment = $xaction->getApplicationTransactionCommentObject() | $comment = $xaction->getApplicationTransactionCommentObject() | ||||
->setContent('') | ->setContent('') | ||||
->setIsRemoved(true); | ->setIsRemoved(true); | ||||
$editor = id(new PhabricatorApplicationTransactionCommentEditor()) | $editor = id(new PhabricatorApplicationTransactionCommentEditor()) | ||||
->setActor($viewer) | ->setActor($viewer) | ||||
->setRequest($request) | ->setRequest($request) | ||||
Show All 34 Lines |