mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
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:
parent
7705f452d2
commit
1df321bf00
5 changed files with 27 additions and 23 deletions
|
@ -11,7 +11,7 @@ return array(
|
|||
'core.pkg.js' => '5a1c336d',
|
||||
'darkconsole.pkg.js' => '8ab24e01',
|
||||
'differential.pkg.css' => '5f5d3a4c',
|
||||
'differential.pkg.js' => '58dae818',
|
||||
'differential.pkg.js' => '6b52883b',
|
||||
'diffusion.pkg.css' => '591664fa',
|
||||
'diffusion.pkg.js' => 'bfc0737b',
|
||||
'maniphest.pkg.css' => '68d4dd3d',
|
||||
|
@ -367,7 +367,7 @@ return array(
|
|||
'rsrc/js/application/differential/behavior-comment-preview.js' => '6932def3',
|
||||
'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1',
|
||||
'rsrc/js/application/differential/behavior-dropdown-menus.js' => '2035b9cb',
|
||||
'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '334267b3',
|
||||
'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '1360cac8',
|
||||
'rsrc/js/application/differential/behavior-keyboard-nav.js' => '2c426492',
|
||||
'rsrc/js/application/differential/behavior-populate.js' => '8694b1df',
|
||||
'rsrc/js/application/differential/behavior-show-field-details.js' => 'bba9eedf',
|
||||
|
@ -569,7 +569,7 @@ return array(
|
|||
'javelin-behavior-differential-comment-jump' => '4fdb476d',
|
||||
'javelin-behavior-differential-diff-radios' => 'e1ff79b1',
|
||||
'javelin-behavior-differential-dropdown-menus' => '2035b9cb',
|
||||
'javelin-behavior-differential-edit-inline-comments' => '334267b3',
|
||||
'javelin-behavior-differential-edit-inline-comments' => '1360cac8',
|
||||
'javelin-behavior-differential-feedback-preview' => '6932def3',
|
||||
'javelin-behavior-differential-keyboard-navigation' => '2c426492',
|
||||
'javelin-behavior-differential-populate' => '8694b1df',
|
||||
|
@ -889,6 +889,14 @@ return array(
|
|||
'javelin-install',
|
||||
'javelin-util',
|
||||
),
|
||||
'1360cac8' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
'javelin-vector',
|
||||
'differential-inline-comment-editor',
|
||||
),
|
||||
'13c739ea' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
@ -1027,14 +1035,6 @@ return array(
|
|||
'331b1611' => array(
|
||||
'javelin-install',
|
||||
),
|
||||
'334267b3' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
'javelin-dom',
|
||||
'javelin-util',
|
||||
'javelin-vector',
|
||||
'differential-inline-comment-editor',
|
||||
),
|
||||
'3ab51e2c' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-behavior-device',
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
|
|
|
@ -269,20 +269,11 @@ JX.behavior('differential-edit-inline-comments', function(config) {
|
|||
} else {
|
||||
root = e.getNode('differential-changeset');
|
||||
if (root) {
|
||||
|
||||
var data = e.getNodeData('differential-inline-comment');
|
||||
var change = e.getNodeData('differential-changeset');
|
||||
|
||||
var id_part = data.on_right ? change.right : change.left;
|
||||
|
||||
// NOTE: We can't just look for 'tag:td' because the event might be
|
||||
// inside a table which is inside an inline comment.
|
||||
var comment = e.getNode('differential-inline-comment');
|
||||
var td = JX.DOM.findAbove(comment, 'td');
|
||||
var th = td.previousSibling;
|
||||
|
||||
// TODO: For one-up views, this is incorrect!
|
||||
var new_part = isNewFile(th) ? 'N' : 'O';
|
||||
var id_part = data.on_right ? change.right : change.left;
|
||||
var new_part = data.isNewFile ? 'N' : 'O';
|
||||
var prefix = 'C' + id_part + new_part + 'L';
|
||||
|
||||
origin = JX.$(prefix + data.number);
|
||||
|
|
Loading…
Reference in a new issue