1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 09:12:41 +01:00

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
This commit is contained in:
epriestley 2015-03-09 12:53:40 -07:00
parent 9b9a8001fa
commit f1f2c5d01d
6 changed files with 14 additions and 36 deletions

View file

@ -438,7 +438,7 @@ abstract class DifferentialChangesetHTMLRenderer
return id(new PHUIDiffInlineCommentDetailView())
->setInlineComment($comment)
->setOnRight($on_right)
->setIsOnRight($on_right)
->setHandles($this->getHandles())
->setMarkupEngine($this->getMarkupEngine())
->setEditable($edit)

View file

@ -236,7 +236,7 @@ abstract class PhabricatorInlineCommentController
$edit_dialog = id(new PHUIDiffInlineCommentEditView())
->setUser($user)
->setSubmitURI($request->getRequestURI())
->setOnRight($this->getIsOnRight())
->setIsOnRight($this->getIsOnRight())
->setIsNewFile($this->getIsNewFile())
->setNumber($this->getLineNumber())
->setLength($this->getLineLength())
@ -275,7 +275,7 @@ abstract class PhabricatorInlineCommentController
$view = id(new PHUIDiffInlineCommentDetailView())
->setInlineComment($inline)
->setOnRight($on_right)
->setIsOnRight($on_right)
->setMarkupEngine($engine)
->setHandles($handles)
->setEditable(true);

View file

@ -4,7 +4,6 @@ final class PHUIDiffInlineCommentDetailView
extends PHUIDiffInlineCommentView {
private $inlineComment;
private $onRight;
private $handles;
private $markupEngine;
private $editable;
@ -12,20 +11,11 @@ final class PHUIDiffInlineCommentDetailView
private $allowReply;
private $renderer;
public function getIsOnRight() {
return $this->onRight;
}
public function setInlineComment(PhabricatorInlineCommentInterface $comment) {
$this->inlineComment = $comment;
return $this;
}
public function setOnRight($on_right) {
$this->onRight = $on_right;
return $this;
}
public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
@ -81,7 +71,7 @@ final class PHUIDiffInlineCommentDetailView
'number' => $inline->getLineNumber(),
'length' => $inline->getLineLength(),
'isNewFile' => (bool)$inline->getIsNewFile(),
'on_right' => $this->onRight,
'on_right' => $this->getIsOnRight(),
'original' => $inline->getContent(),
'replyToCommentPHID' => $inline->getReplyToCommentPHID(),
);

View file

@ -6,7 +6,6 @@ final class PHUIDiffInlineCommentEditView
private $inputs = array();
private $uri;
private $title;
private $onRight;
private $number;
private $length;
private $renderer;
@ -23,10 +22,6 @@ final class PHUIDiffInlineCommentEditView
return $this->isNewFile;
}
public function getIsOnRight() {
return $this->onRight;
}
public function setRenderer($renderer) {
$this->renderer = $renderer;
return $this;
@ -69,11 +64,6 @@ final class PHUIDiffInlineCommentEditView
return $this->changesetID;
}
public function setOnRight($on_right) {
$this->onRight = $on_right;
return $this;
}
public function setNumber($number) {
$this->number = $number;
return $this;

View file

@ -9,17 +9,6 @@
final class PHUIDiffInlineCommentUndoView
extends PHUIDiffInlineCommentView {
private $isOnRight;
public function setIsOnRight($is_on_right) {
$this->isOnRight = $is_on_right;
return $this;
}
public function getIsOnRight() {
return $this->isOnRight;
}
public function render() {
$link = javelin_tag(
'a',

View file

@ -2,6 +2,15 @@
abstract class PHUIDiffInlineCommentView extends AphrontView {
abstract public function getIsOnRight();
private $isOnRight;
public function getIsOnRight() {
return $this->isOnRight;
}
public function setIsOnRight($on_right) {
$this->isOnRight = $on_right;
return $this;
}
}