diff --git a/resources/celerity/map.php b/resources/celerity/map.php --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -11,7 +11,7 @@ '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 @@ '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 @@ '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 @@ '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 @@ '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', diff --git a/src/infrastructure/diff/PhabricatorInlineCommentController.php b/src/infrastructure/diff/PhabricatorInlineCommentController.php --- a/src/infrastructure/diff/PhabricatorInlineCommentController.php +++ b/src/infrastructure/diff/PhabricatorInlineCommentController.php @@ -201,6 +201,7 @@ ->setUser($user) ->setSubmitURI($request->getRequestURI()) ->setOnRight($this->getIsOnRight()) + ->setIsNewFile($this->getIsNewFile()) ->setNumber($this->getLineNumber()) ->setLength($this->getLineLength()) ->setRenderer($this->getRenderer()); diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php --- a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php +++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php @@ -78,6 +78,7 @@ 'id' => $inline->getID(), 'number' => $inline->getLineNumber(), 'length' => $inline->getLineLength(), + 'isNewFile' => (bool)$inline->getIsNewFile(), 'on_right' => $this->onRight, 'original' => $inline->getContent(), ); diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php --- a/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php +++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php @@ -10,6 +10,16 @@ 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 @@ '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, ), diff --git a/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js b/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js --- a/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js +++ b/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js @@ -269,20 +269,11 @@ } 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);