Differential D21186 Diff 50452 src/applications/diffusion/controller/DiffusionInlineCommentController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionInlineCommentController.php
| Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | private function canEditInlineComment( | ||||
| PhabricatorAuditInlineComment $inline) { | PhabricatorAuditInlineComment $inline) { | ||||
| // Only the author may edit a comment. | // Only the author may edit a comment. | ||||
| if ($inline->getAuthorPHID() != $viewer->getPHID()) { | if ($inline->getAuthorPHID() != $viewer->getPHID()) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| // Saved comments may not be edited. | // Saved comments may not be edited. | ||||
| if ($inline->getAuditCommentID()) { | if ($inline->getTransactionPHID()) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| // Inline must be attached to the active revision. | // Inline must be attached to the active revision. | ||||
| if ($inline->getCommitPHID() != $this->getCommitPHID()) { | if ($inline->getCommitPHID() != $this->getCommitPHID()) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| protected function deleteComment(PhabricatorInlineCommentInterface $inline) { | protected function deleteComment(PhabricatorInlineComment $inline) { | ||||
| $inline->setIsDeleted(1)->save(); | $inline->setIsDeleted(1)->save(); | ||||
| } | } | ||||
| protected function undeleteComment( | protected function undeleteComment( | ||||
| PhabricatorInlineCommentInterface $inline) { | PhabricatorInlineComment $inline) { | ||||
| $inline->setIsDeleted(0)->save(); | $inline->setIsDeleted(0)->save(); | ||||
| } | } | ||||
| protected function saveComment(PhabricatorInlineCommentInterface $inline) { | protected function saveComment(PhabricatorInlineComment $inline) { | ||||
| return $inline->save(); | return $inline->save(); | ||||
| } | } | ||||
| protected function loadObjectOwnerPHID( | protected function loadObjectOwnerPHID( | ||||
| PhabricatorInlineCommentInterface $inline) { | PhabricatorInlineComment $inline) { | ||||
| return $this->loadCommit()->getAuthorPHID(); | return $this->loadCommit()->getAuthorPHID(); | ||||
| } | } | ||||
| } | } | ||||