diff --git a/src/applications/differential/controller/DifferentialInlineCommentEditController.php b/src/applications/differential/controller/DifferentialInlineCommentEditController.php index 926158cb41..2e44e86822 100644 --- a/src/applications/differential/controller/DifferentialInlineCommentEditController.php +++ b/src/applications/differential/controller/DifferentialInlineCommentEditController.php @@ -77,19 +77,17 @@ final class DifferentialInlineCommentEditController } protected function loadCommentForEdit($id) { - $request = $this->getRequest(); - $user = $request->getUser(); + $viewer = $this->getViewer(); $inline = $this->loadComment($id); - if (!$this->canEditInlineComment($user, $inline)) { + if (!$this->canEditInlineComment($viewer, $inline)) { throw new Exception(pht('That comment is not editable!')); } return $inline; } protected function loadCommentForDone($id) { - $request = $this->getRequest(); - $viewer = $request->getUser(); + $viewer = $this->getViewer(); $inline = $this->loadComment($id); if (!$inline) { @@ -128,11 +126,11 @@ final class DifferentialInlineCommentEditController } private function canEditInlineComment( - PhabricatorUser $user, + PhabricatorUser $viewer, DifferentialInlineComment $inline) { // Only the author may edit a comment. - if ($inline->getAuthorPHID() != $user->getPHID()) { + if ($inline->getAuthorPHID() != $viewer->getPHID()) { return false; } diff --git a/src/applications/diffusion/controller/DiffusionInlineCommentController.php b/src/applications/diffusion/controller/DiffusionInlineCommentController.php index 8af9a1cd65..bc7448a9e2 100644 --- a/src/applications/diffusion/controller/DiffusionInlineCommentController.php +++ b/src/applications/diffusion/controller/DiffusionInlineCommentController.php @@ -50,19 +50,17 @@ final class DiffusionInlineCommentController } protected function loadCommentForEdit($id) { - $request = $this->getRequest(); - $user = $request->getUser(); + $viewer = $this->getViewer(); $inline = $this->loadComment($id); - if (!$this->canEditInlineComment($user, $inline)) { + if (!$this->canEditInlineComment($viewer, $inline)) { throw new Exception(pht('That comment is not editable!')); } return $inline; } protected function loadCommentForDone($id) { - $request = $this->getRequest(); - $viewer = $request->getUser(); + $viewer = $this->getViewer(); $inline = $this->loadComment($id); if (!$inline) { @@ -86,11 +84,11 @@ final class DiffusionInlineCommentController } private function canEditInlineComment( - PhabricatorUser $user, + PhabricatorUser $viewer, PhabricatorAuditInlineComment $inline) { // Only the author may edit a comment. - if ($inline->getAuthorPHID() != $user->getPHID()) { + if ($inline->getAuthorPHID() != $viewer->getPHID()) { return false; } diff --git a/src/infrastructure/diff/PhabricatorInlineCommentController.php b/src/infrastructure/diff/PhabricatorInlineCommentController.php index d7f1a9dd3a..22e410612a 100644 --- a/src/infrastructure/diff/PhabricatorInlineCommentController.php +++ b/src/infrastructure/diff/PhabricatorInlineCommentController.php @@ -88,7 +88,7 @@ abstract class PhabricatorInlineCommentController public function processRequest() { $request = $this->getRequest(); - $user = $request->getUser(); + $viewer = $this->getViewer(); $this->readRequestParameters(); @@ -221,7 +221,7 @@ abstract class PhabricatorInlineCommentController $inline = $this->createComment() ->setChangesetID($this->getChangesetID()) - ->setAuthorPHID($user->getPHID()) + ->setAuthorPHID($viewer->getPHID()) ->setLineNumber($this->getLineNumber()) ->setLineLength($this->getLineLength()) ->setIsNewFile($this->getIsNewFile()) @@ -313,10 +313,10 @@ abstract class PhabricatorInlineCommentController private function buildEditDialog() { $request = $this->getRequest(); - $user = $request->getUser(); + $viewer = $this->getViewer(); $edit_dialog = id(new PHUIDiffInlineCommentEditView()) - ->setUser($user) + ->setUser($viewer) ->setSubmitURI($request->getRequestURI()) ->setIsOnRight($this->getIsOnRight()) ->setIsNewFile($this->getIsNewFile()) @@ -342,22 +342,22 @@ abstract class PhabricatorInlineCommentController $on_right) { $request = $this->getRequest(); - $user = $request->getUser(); + $viewer = $this->getViewer(); $engine = new PhabricatorMarkupEngine(); - $engine->setViewer($user); + $engine->setViewer($viewer); $engine->addObject( $inline, PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY); $engine->process(); - $phids = array($user->getPHID()); + $phids = array($viewer->getPHID()); $handles = $this->loadViewerHandles($phids); $object_owner_phid = $this->loadObjectOwnerPHID($inline); $view = id(new PHUIDiffInlineCommentDetailView()) - ->setUser($user) + ->setUser($viewer) ->setInlineComment($inline) ->setIsOnRight($on_right) ->setMarkupEngine($engine) @@ -378,7 +378,7 @@ abstract class PhabricatorInlineCommentController private function renderTextArea($text) { return id(new PhabricatorRemarkupControl()) - ->setUser($this->getRequest()->getUser()) + ->setViewer($this->getViewer()) ->setSigil('differential-inline-comment-edit-textarea') ->setName('text') ->setValue($text)