Differential D16031 Diff 38563 src/applications/differential/controller/DifferentialInlineCommentEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/controller/DifferentialInlineCommentEditController.php
| Show All 17 Lines | final class DifferentialInlineCommentEditController | ||||
| if (!$revision) { | if (!$revision) { | ||||
| throw new Exception(pht('Invalid revision ID "%s".', $revision_id)); | throw new Exception(pht('Invalid revision ID "%s".', $revision_id)); | ||||
| } | } | ||||
| return $revision; | return $revision; | ||||
| } | } | ||||
| protected function createComment() { | protected function createComment() { | ||||
| // Verify revision and changeset correspond to actual objects. | // Verify revision and changeset correspond to actual objects, and are | ||||
| // connected to one another. | |||||
| $changeset_id = $this->getChangesetID(); | $changeset_id = $this->getChangesetID(); | ||||
| $viewer = $this->getViewer(); | |||||
| $revision = $this->loadRevision(); | $revision = $this->loadRevision(); | ||||
| if (!id(new DifferentialChangeset())->load($changeset_id)) { | $changeset = id(new DifferentialChangesetQuery()) | ||||
| throw new Exception(pht('Invalid changeset ID!')); | ->setViewer($viewer) | ||||
| ->withIDs(array($changeset_id)) | |||||
| ->executeOne(); | |||||
| if (!$changeset) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'Invalid changeset ID "%s"!', | |||||
| $changeset_id)); | |||||
| } | |||||
| $diff = $changeset->getDiff(); | |||||
| if ($diff->getRevisionID() != $revision->getID()) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'Changeset ID "%s" is part of diff ID "%s", but that diff '. | |||||
| 'is attached to reivsion "%s", not revision "%s".', | |||||
chad: reivsion | |||||
| $changeset_id, | |||||
| $diff->getID(), | |||||
| $diff->getRevisionID(), | |||||
| $revision->getID())); | |||||
| } | } | ||||
| return id(new DifferentialInlineComment()) | return id(new DifferentialInlineComment()) | ||||
| ->setRevision($revision) | ->setRevision($revision) | ||||
| ->setChangesetID($changeset_id); | ->setChangesetID($changeset_id); | ||||
| } | } | ||||
| protected function loadComment($id) { | protected function loadComment($id) { | ||||
| ▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines | |||||
reivsion