Fix left/right detection of inline comments in unified view
Summary: Ref T2009. Currently, the code figures out if a comment is on the left or right by looking at the `<th />` preceeding the enclosing `<td />`. This gets the right result in 2-up, but in 1-up rows are always `<th />`, `<th />`, `<td />`, so it always detects every inline as being in the new file. Because "old" and "new" cells aren't inherently distingushable in the 1up view, we can't use a DOM test for this at all. Instead, just track this state explicitly. Test Plan: - Made left/right comments in 1up view and 2up view. - Viewed them in 1up and 2up views. - Hovered in 1up and 2up views. - Diff-of-diff'd and reviewed old/new comments, then made some more. Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T2009 Differential Revision: https://secure.phabricator.com/D12011
This commit is contained in:
@@ -201,6 +201,7 @@ abstract class PhabricatorInlineCommentController
|
||||
->setUser($user)
|
||||
->setSubmitURI($request->getRequestURI())
|
||||
->setOnRight($this->getIsOnRight())
|
||||
->setIsNewFile($this->getIsNewFile())
|
||||
->setNumber($this->getLineNumber())
|
||||
->setLength($this->getLineLength())
|
||||
->setRenderer($this->getRenderer());
|
||||
|
||||
@@ -78,6 +78,7 @@ final class PHUIDiffInlineCommentDetailView
|
||||
'id' => $inline->getID(),
|
||||
'number' => $inline->getLineNumber(),
|
||||
'length' => $inline->getLineLength(),
|
||||
'isNewFile' => (bool)$inline->getIsNewFile(),
|
||||
'on_right' => $this->onRight,
|
||||
'original' => $inline->getContent(),
|
||||
);
|
||||
|
||||
@@ -10,6 +10,16 @@ final class PHUIDiffInlineCommentEditView
|
||||
private $number;
|
||||
private $length;
|
||||
private $renderer;
|
||||
private $isNewFile;
|
||||
|
||||
public function setIsNewFile($is_new_file) {
|
||||
$this->isNewFile = $is_new_file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIsNewFile() {
|
||||
return $this->isNewFile;
|
||||
}
|
||||
|
||||
public function getIsOnRight() {
|
||||
return $this->onRight;
|
||||
@@ -160,7 +170,8 @@ final class PHUIDiffInlineCommentEditView
|
||||
'class' => 'differential-inline-comment-edit',
|
||||
'sigil' => 'differential-inline-comment',
|
||||
'meta' => array(
|
||||
'on_right' => $this->onRight,
|
||||
'on_right' => $this->getIsOnRight(),
|
||||
'isNewFile' => (bool)$this->getIsNewFile(),
|
||||
'number' => $this->number,
|
||||
'length' => $this->length,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user