Differential D20551 Diff 49035 src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php
| Show All 25 Lines | public function handleRequest(AphrontRequest $request) { | ||||
| } | } | ||||
| $phid = $xaction->getObjectPHID(); | $phid = $xaction->getObjectPHID(); | ||||
| $handles = $viewer->loadHandles(array($phid)); | $handles = $viewer->loadHandles(array($phid)); | ||||
| $obj_handle = $handles[$phid]; | $obj_handle = $handles[$phid]; | ||||
| $done_uri = $obj_handle->getURI(); | $done_uri = $obj_handle->getURI(); | ||||
| // If an object is locked, you can't edit comments on it. Two reasons to | |||||
| // lock threads are to calm contentious issues and to freeze state for | |||||
| // auditing, and editing comments serves neither goal. | |||||
| $object = $xaction->getObject(); | |||||
| $can_interact = PhabricatorPolicyFilter::hasCapability( | |||||
| $viewer, | |||||
| $object, | |||||
| PhabricatorPolicyCapability::CAN_INTERACT); | |||||
| if (!$can_interact) { | |||||
| return $this->newDialog() | |||||
| ->setTitle(pht('Conversation Locked')) | |||||
| ->appendParagraph( | |||||
| pht( | |||||
| 'You can not edit this comment because the conversation is '. | |||||
| 'locked.')) | |||||
| ->addCancelButton($done_uri); | |||||
| } | |||||
| if ($request->isFormOrHisecPost()) { | if ($request->isFormOrHisecPost()) { | ||||
| $text = $request->getStr('text'); | $text = $request->getStr('text'); | ||||
| $comment = $xaction->getApplicationTransactionCommentObject(); | $comment = $xaction->getApplicationTransactionCommentObject(); | ||||
| $comment->setContent($text); | $comment->setContent($text); | ||||
| if (!strlen($text)) { | if (!strlen($text)) { | ||||
| $comment->setIsDeleted(true); | $comment->setIsDeleted(true); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines | |||||