@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.

Reduce code duplication in inline right/left side tracking

Summary: Ref T2009. These subclasses have a mixture of similar methods, move them all to the base class.

Test Plan: Created/edited/undo/submitted comments on the left and right sides of a diff.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2009

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

+14 -36
+1 -1
src/applications/differential/render/DifferentialChangesetHTMLRenderer.php
··· 438 438 439 439 return id(new PHUIDiffInlineCommentDetailView()) 440 440 ->setInlineComment($comment) 441 - ->setOnRight($on_right) 441 + ->setIsOnRight($on_right) 442 442 ->setHandles($this->getHandles()) 443 443 ->setMarkupEngine($this->getMarkupEngine()) 444 444 ->setEditable($edit)
+2 -2
src/infrastructure/diff/PhabricatorInlineCommentController.php
··· 236 236 $edit_dialog = id(new PHUIDiffInlineCommentEditView()) 237 237 ->setUser($user) 238 238 ->setSubmitURI($request->getRequestURI()) 239 - ->setOnRight($this->getIsOnRight()) 239 + ->setIsOnRight($this->getIsOnRight()) 240 240 ->setIsNewFile($this->getIsNewFile()) 241 241 ->setNumber($this->getLineNumber()) 242 242 ->setLength($this->getLineLength()) ··· 275 275 276 276 $view = id(new PHUIDiffInlineCommentDetailView()) 277 277 ->setInlineComment($inline) 278 - ->setOnRight($on_right) 278 + ->setIsOnRight($on_right) 279 279 ->setMarkupEngine($engine) 280 280 ->setHandles($handles) 281 281 ->setEditable(true);
+1 -11
src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
··· 4 4 extends PHUIDiffInlineCommentView { 5 5 6 6 private $inlineComment; 7 - private $onRight; 8 7 private $handles; 9 8 private $markupEngine; 10 9 private $editable; 11 10 private $preview; 12 11 private $allowReply; 13 12 private $renderer; 14 - 15 - public function getIsOnRight() { 16 - return $this->onRight; 17 - } 18 13 19 14 public function setInlineComment(PhabricatorInlineCommentInterface $comment) { 20 15 $this->inlineComment = $comment; 21 - return $this; 22 - } 23 - 24 - public function setOnRight($on_right) { 25 - $this->onRight = $on_right; 26 16 return $this; 27 17 } 28 18 ··· 81 71 'number' => $inline->getLineNumber(), 82 72 'length' => $inline->getLineLength(), 83 73 'isNewFile' => (bool)$inline->getIsNewFile(), 84 - 'on_right' => $this->onRight, 74 + 'on_right' => $this->getIsOnRight(), 85 75 'original' => $inline->getContent(), 86 76 'replyToCommentPHID' => $inline->getReplyToCommentPHID(), 87 77 );
-10
src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php
··· 6 6 private $inputs = array(); 7 7 private $uri; 8 8 private $title; 9 - private $onRight; 10 9 private $number; 11 10 private $length; 12 11 private $renderer; ··· 21 20 22 21 public function getIsNewFile() { 23 22 return $this->isNewFile; 24 - } 25 - 26 - public function getIsOnRight() { 27 - return $this->onRight; 28 23 } 29 24 30 25 public function setRenderer($renderer) { ··· 67 62 68 63 public function getChangesetID() { 69 64 return $this->changesetID; 70 - } 71 - 72 - public function setOnRight($on_right) { 73 - $this->onRight = $on_right; 74 - return $this; 75 65 } 76 66 77 67 public function setNumber($number) {
-11
src/infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php
··· 9 9 final class PHUIDiffInlineCommentUndoView 10 10 extends PHUIDiffInlineCommentView { 11 11 12 - private $isOnRight; 13 - 14 - public function setIsOnRight($is_on_right) { 15 - $this->isOnRight = $is_on_right; 16 - return $this; 17 - } 18 - 19 - public function getIsOnRight() { 20 - return $this->isOnRight; 21 - } 22 - 23 12 public function render() { 24 13 $link = javelin_tag( 25 14 'a',
+10 -1
src/infrastructure/diff/view/PHUIDiffInlineCommentView.php
··· 2 2 3 3 abstract class PHUIDiffInlineCommentView extends AphrontView { 4 4 5 - abstract public function getIsOnRight(); 5 + private $isOnRight; 6 + 7 + public function getIsOnRight() { 8 + return $this->isOnRight; 9 + } 10 + 11 + public function setIsOnRight($on_right) { 12 + $this->isOnRight = $on_right; 13 + return $this; 14 + } 6 15 7 16 }