Differential D17205 Diff 41368 src/applications/differential/controller/DifferentialInlineCommentEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/controller/DifferentialInlineCommentEditController.php
| Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | if ($inline->getRevisionID() != $this->getRevisionID()) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| protected function deleteComment(PhabricatorInlineCommentInterface $inline) { | protected function deleteComment(PhabricatorInlineCommentInterface $inline) { | ||||
| $inline->openTransaction(); | $inline->openTransaction(); | ||||
| $inline->setIsDeleted(1)->save(); | $inline->setIsDeleted(1)->save(); | ||||
| DifferentialDraft::deleteHasDraft( | $this->syncDraft(); | ||||
| $inline->getAuthorPHID(), | |||||
| $inline->getRevisionPHID(), | |||||
| $inline->getPHID()); | |||||
| $inline->saveTransaction(); | $inline->saveTransaction(); | ||||
| } | } | ||||
| protected function undeleteComment( | protected function undeleteComment( | ||||
| PhabricatorInlineCommentInterface $inline) { | PhabricatorInlineCommentInterface $inline) { | ||||
| $inline->openTransaction(); | $inline->openTransaction(); | ||||
| $inline->setIsDeleted(0)->save(); | $inline->setIsDeleted(0)->save(); | ||||
| DifferentialDraft::markHasDraft( | $this->syncDraft(); | ||||
| $inline->getAuthorPHID(), | |||||
| $inline->getRevisionPHID(), | |||||
| $inline->getPHID()); | |||||
| $inline->saveTransaction(); | $inline->saveTransaction(); | ||||
| } | } | ||||
| protected function saveComment(PhabricatorInlineCommentInterface $inline) { | protected function saveComment(PhabricatorInlineCommentInterface $inline) { | ||||
| $inline->openTransaction(); | $inline->openTransaction(); | ||||
| $inline->save(); | $inline->save(); | ||||
| DifferentialDraft::markHasDraft( | $this->syncDraft(); | ||||
| $inline->getAuthorPHID(), | |||||
| $inline->getRevisionPHID(), | |||||
| $inline->getPHID()); | |||||
| $inline->saveTransaction(); | $inline->saveTransaction(); | ||||
| } | } | ||||
| protected function loadObjectOwnerPHID( | protected function loadObjectOwnerPHID( | ||||
| PhabricatorInlineCommentInterface $inline) { | PhabricatorInlineCommentInterface $inline) { | ||||
| return $this->loadRevision()->getAuthorPHID(); | return $this->loadRevision()->getAuthorPHID(); | ||||
| } | } | ||||
| Show All 26 Lines | protected function showComments(array $ids) { | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'DELETE FROM %T WHERE userPHID = %s AND commentID IN (%Ld)', | 'DELETE FROM %T WHERE userPHID = %s AND commentID IN (%Ld)', | ||||
| $table->getTableName(), | $table->getTableName(), | ||||
| $viewer->getPHID(), | $viewer->getPHID(), | ||||
| $ids); | $ids); | ||||
| } | } | ||||
| private function syncDraft() { | |||||
| $viewer = $this->getViewer(); | |||||
| $revision = $this->loadRevision(); | |||||
| $revision->newDraftEngine() | |||||
| ->setObject($revision) | |||||
| ->setViewer($viewer) | |||||
| ->synchronize(); | |||||
| } | |||||
| } | } | ||||