@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update some inline comment logic to use more modern "Viewer"-oriented calls/variables

Summary:
Ref T13195. Ref T8573. The inline comment controllers currently use outdated `$user = $this->getRequest()->getUser()` calls.

Instead, use `$viewer = $this->getViewer()`.

This is just a small consistency update with no behavioral changes.

Test Plan: Viewed and added inlines in Differential and Diffusion.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13195, T8573

Differential Revision: https://secure.phabricator.com/D19633

+19 -23
+5 -7
src/applications/differential/controller/DifferentialInlineCommentEditController.php
··· 77 77 } 78 78 79 79 protected function loadCommentForEdit($id) { 80 - $request = $this->getRequest(); 81 - $user = $request->getUser(); 80 + $viewer = $this->getViewer(); 82 81 83 82 $inline = $this->loadComment($id); 84 - if (!$this->canEditInlineComment($user, $inline)) { 83 + if (!$this->canEditInlineComment($viewer, $inline)) { 85 84 throw new Exception(pht('That comment is not editable!')); 86 85 } 87 86 return $inline; 88 87 } 89 88 90 89 protected function loadCommentForDone($id) { 91 - $request = $this->getRequest(); 92 - $viewer = $request->getUser(); 90 + $viewer = $this->getViewer(); 93 91 94 92 $inline = $this->loadComment($id); 95 93 if (!$inline) { ··· 128 126 } 129 127 130 128 private function canEditInlineComment( 131 - PhabricatorUser $user, 129 + PhabricatorUser $viewer, 132 130 DifferentialInlineComment $inline) { 133 131 134 132 // Only the author may edit a comment. 135 - if ($inline->getAuthorPHID() != $user->getPHID()) { 133 + if ($inline->getAuthorPHID() != $viewer->getPHID()) { 136 134 return false; 137 135 } 138 136
+5 -7
src/applications/diffusion/controller/DiffusionInlineCommentController.php
··· 50 50 } 51 51 52 52 protected function loadCommentForEdit($id) { 53 - $request = $this->getRequest(); 54 - $user = $request->getUser(); 53 + $viewer = $this->getViewer(); 55 54 56 55 $inline = $this->loadComment($id); 57 - if (!$this->canEditInlineComment($user, $inline)) { 56 + if (!$this->canEditInlineComment($viewer, $inline)) { 58 57 throw new Exception(pht('That comment is not editable!')); 59 58 } 60 59 return $inline; 61 60 } 62 61 63 62 protected function loadCommentForDone($id) { 64 - $request = $this->getRequest(); 65 - $viewer = $request->getUser(); 63 + $viewer = $this->getViewer(); 66 64 67 65 $inline = $this->loadComment($id); 68 66 if (!$inline) { ··· 86 84 } 87 85 88 86 private function canEditInlineComment( 89 - PhabricatorUser $user, 87 + PhabricatorUser $viewer, 90 88 PhabricatorAuditInlineComment $inline) { 91 89 92 90 // Only the author may edit a comment. 93 - if ($inline->getAuthorPHID() != $user->getPHID()) { 91 + if ($inline->getAuthorPHID() != $viewer->getPHID()) { 94 92 return false; 95 93 } 96 94
+9 -9
src/infrastructure/diff/PhabricatorInlineCommentController.php
··· 88 88 89 89 public function processRequest() { 90 90 $request = $this->getRequest(); 91 - $user = $request->getUser(); 91 + $viewer = $this->getViewer(); 92 92 93 93 $this->readRequestParameters(); 94 94 ··· 221 221 222 222 $inline = $this->createComment() 223 223 ->setChangesetID($this->getChangesetID()) 224 - ->setAuthorPHID($user->getPHID()) 224 + ->setAuthorPHID($viewer->getPHID()) 225 225 ->setLineNumber($this->getLineNumber()) 226 226 ->setLineLength($this->getLineLength()) 227 227 ->setIsNewFile($this->getIsNewFile()) ··· 313 313 314 314 private function buildEditDialog() { 315 315 $request = $this->getRequest(); 316 - $user = $request->getUser(); 316 + $viewer = $this->getViewer(); 317 317 318 318 $edit_dialog = id(new PHUIDiffInlineCommentEditView()) 319 - ->setUser($user) 319 + ->setUser($viewer) 320 320 ->setSubmitURI($request->getRequestURI()) 321 321 ->setIsOnRight($this->getIsOnRight()) 322 322 ->setIsNewFile($this->getIsNewFile()) ··· 342 342 $on_right) { 343 343 344 344 $request = $this->getRequest(); 345 - $user = $request->getUser(); 345 + $viewer = $this->getViewer(); 346 346 347 347 $engine = new PhabricatorMarkupEngine(); 348 - $engine->setViewer($user); 348 + $engine->setViewer($viewer); 349 349 $engine->addObject( 350 350 $inline, 351 351 PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY); 352 352 $engine->process(); 353 353 354 - $phids = array($user->getPHID()); 354 + $phids = array($viewer->getPHID()); 355 355 356 356 $handles = $this->loadViewerHandles($phids); 357 357 $object_owner_phid = $this->loadObjectOwnerPHID($inline); 358 358 359 359 $view = id(new PHUIDiffInlineCommentDetailView()) 360 - ->setUser($user) 360 + ->setUser($viewer) 361 361 ->setInlineComment($inline) 362 362 ->setIsOnRight($on_right) 363 363 ->setMarkupEngine($engine) ··· 378 378 379 379 private function renderTextArea($text) { 380 380 return id(new PhabricatorRemarkupControl()) 381 - ->setUser($this->getRequest()->getUser()) 381 + ->setViewer($this->getViewer()) 382 382 ->setSigil('differential-inline-comment-edit-textarea') 383 383 ->setName('text') 384 384 ->setValue($text)