diff --git a/resources/celerity/map.php b/resources/celerity/map.php index e32bccdcda..70b982beae 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -13,7 +13,7 @@ return array( 'core.pkg.js' => '2ff7879f', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => '58712637', - 'differential.pkg.js' => '3a7c5866', + 'differential.pkg.js' => '6375358e', 'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.js' => '84c8f8fd', 'favicon.ico' => '30672e08', @@ -390,15 +390,14 @@ return array( 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173', 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', - 'rsrc/js/application/diff/DiffChangeset.js' => '454cfe59', - 'rsrc/js/application/diff/DiffChangesetList.js' => '50bc5b50', - 'rsrc/js/application/diff/DiffInline.js' => '38a957be', + 'rsrc/js/application/diff/DiffChangeset.js' => '4c9c47ad', + 'rsrc/js/application/diff/DiffChangesetList.js' => '589a30aa', + 'rsrc/js/application/diff/DiffInline.js' => '98c12b2f', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', - 'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => '9ed8d2b6', 'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d', 'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76', 'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1', - 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '995c805a', + 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '89d11432', 'rsrc/js/application/differential/behavior-keyboard-nav.js' => '92904457', 'rsrc/js/application/differential/behavior-populate.js' => '5e41c819', 'rsrc/js/application/differential/behavior-toggle-files.js' => 'ca3f91eb', @@ -572,7 +571,6 @@ return array( 'd3' => 'a11a5ff2', 'differential-changeset-view-css' => '41af6d25', 'differential-core-view-css' => '5b7b8ff4', - 'differential-inline-comment-editor' => '9ed8d2b6', 'differential-revision-add-comment-css' => 'c47f8c40', 'differential-revision-comment-css' => '14b8565a', 'differential-revision-history-css' => '0e8eb855', @@ -624,7 +622,7 @@ return array( 'javelin-behavior-diff-preview-link' => '051c7832', 'javelin-behavior-differential-comment-jump' => '4fdb476d', 'javelin-behavior-differential-diff-radios' => 'e1ff79b1', - 'javelin-behavior-differential-edit-inline-comments' => '995c805a', + 'javelin-behavior-differential-edit-inline-comments' => '89d11432', 'javelin-behavior-differential-feedback-preview' => 'b064af76', 'javelin-behavior-differential-keyboard-navigation' => '92904457', 'javelin-behavior-differential-populate' => '5e41c819', @@ -785,9 +783,9 @@ return array( 'phabricator-darklog' => 'c8e1ffe3', 'phabricator-darkmessage' => 'c48cccdd', 'phabricator-dashboard-css' => 'fe5b1869', - 'phabricator-diff-changeset' => '454cfe59', - 'phabricator-diff-changeset-list' => '50bc5b50', - 'phabricator-diff-inline' => '38a957be', + 'phabricator-diff-changeset' => '4c9c47ad', + 'phabricator-diff-changeset-list' => '589a30aa', + 'phabricator-diff-inline' => '98c12b2f', 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 'phabricator-draggable-list' => 'bea6e7f4', 'phabricator-fatal-config-template-css' => '8f18fa41', @@ -1132,9 +1130,6 @@ return array( 'javelin-dom', 'javelin-workflow', ), - '38a957be' => array( - 'javelin-dom', - ), '3ab51e2c' => array( 'javelin-behavior', 'javelin-behavior-device', @@ -1214,17 +1209,6 @@ return array( 'javelin-behavior', 'javelin-dom', ), - '454cfe59' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-workflow', - 'javelin-router', - 'javelin-behavior-device', - 'javelin-vector', - 'phabricator-diff-inline', - ), '469c0d9e' => array( 'javelin-behavior', 'javelin-dom', @@ -1286,6 +1270,17 @@ return array( 'javelin-uri', 'phabricator-notification', ), + '4c9c47ad' => array( + 'javelin-dom', + 'javelin-util', + 'javelin-stratcom', + 'javelin-install', + 'javelin-workflow', + 'javelin-router', + 'javelin-behavior-device', + 'javelin-vector', + 'phabricator-diff-inline', + ), '4d863052' => array( 'javelin-dom', 'javelin-util', @@ -1312,9 +1307,6 @@ return array( 'javelin-typeahead-source', 'javelin-util', ), - '50bc5b50' => array( - 'javelin-install', - ), '519705ea' => array( 'javelin-install', 'javelin-dom', @@ -1356,6 +1348,9 @@ return array( 'javelin-vector', 'javelin-dom', ), + '589a30aa' => array( + 'javelin-install', + ), '58dea2fa' => array( 'javelin-install', 'javelin-util', @@ -1596,6 +1591,13 @@ return array( 'phabricator-draggable-list', 'javelin-workboard-column', ), + '89d11432' => array( + 'javelin-behavior', + 'javelin-stratcom', + 'javelin-dom', + 'javelin-util', + 'javelin-vector', + ), '8a41885b' => array( 'javelin-install', 'javelin-dom', @@ -1675,13 +1677,8 @@ return array( 'javelin-dom', 'javelin-reactor-dom', ), - '995c805a' => array( - 'javelin-behavior', - 'javelin-stratcom', + '98c12b2f' => array( 'javelin-dom', - 'javelin-util', - 'javelin-vector', - 'differential-inline-comment-editor', ), '9a6dd75c' => array( 'javelin-behavior', @@ -1706,14 +1703,6 @@ return array( '9d9685d6' => array( 'phui-oi-list-view-css', ), - '9ed8d2b6' => array( - 'javelin-dom', - 'javelin-util', - 'javelin-stratcom', - 'javelin-install', - 'javelin-request', - 'javelin-workflow', - ), '9f36c42d' => array( 'javelin-behavior', 'javelin-stratcom', @@ -2456,10 +2445,10 @@ return array( 'javelin-behavior-phabricator-object-selector', 'javelin-behavior-repository-crossreference', 'javelin-behavior-load-blame', - 'differential-inline-comment-editor', 'javelin-behavior-differential-toggle-files', 'javelin-behavior-differential-user-select', 'javelin-behavior-aphront-more', + 'phabricator-diff-inline', 'phabricator-diff-changeset', 'phabricator-diff-changeset-list', ), diff --git a/resources/celerity/packages.php b/resources/celerity/packages.php index cac2eff5f8..08752c1b53 100644 --- a/resources/celerity/packages.php +++ b/resources/celerity/packages.php @@ -203,10 +203,11 @@ return array( 'javelin-behavior-repository-crossreference', 'javelin-behavior-load-blame', - 'differential-inline-comment-editor', 'javelin-behavior-differential-toggle-files', 'javelin-behavior-differential-user-select', 'javelin-behavior-aphront-more', + + 'phabricator-diff-inline', 'phabricator-diff-changeset', 'phabricator-diff-changeset-list', ), diff --git a/src/infrastructure/diff/PhabricatorInlineCommentController.php b/src/infrastructure/diff/PhabricatorInlineCommentController.php index 1c624c1ad8..d7f1a9dd3a 100644 --- a/src/infrastructure/diff/PhabricatorInlineCommentController.php +++ b/src/infrastructure/diff/PhabricatorInlineCommentController.php @@ -94,19 +94,6 @@ abstract class PhabricatorInlineCommentController $op = $this->getOperation(); switch ($op) { - case 'busy': - if ($request->isFormPost()) { - return new AphrontAjaxResponse(); - } - - return $this->newDialog() - ->setTitle(pht('Already Editing')) - ->appendParagraph( - pht( - 'You are already editing an inline comment. Finish editing '. - 'your current comment before adding new comments.')) - ->addCancelButton('/') - ->addSubmitButton(pht('Jump to Inline')); case 'hide': case 'show': if (!$request->validateCSRF()) { diff --git a/webroot/rsrc/js/application/diff/DiffChangeset.js b/webroot/rsrc/js/application/diff/DiffChangeset.js index b114198b4f..b1552cf8ce 100644 --- a/webroot/rsrc/js/application/diff/DiffChangeset.js +++ b/webroot/rsrc/js/application/diff/DiffChangeset.js @@ -433,6 +433,18 @@ JX.install('DiffChangeset', { return inline; }, + newInlineReply: function(original) { + var inline = new JX.DiffInline() + .setChangeset(this) + .bindToReply(original); + + this._inlines.push(inline); + + inline.create(); + + return inline; + }, + getInlineByID: function(id) { // TODO: Currently, this will only find inlines which the user has // already interacted with! Inlines are built lazily as events arrive. diff --git a/webroot/rsrc/js/application/diff/DiffChangesetList.js b/webroot/rsrc/js/application/diff/DiffChangesetList.js index e46a33bb56..0f07f4447b 100644 --- a/webroot/rsrc/js/application/diff/DiffChangesetList.js +++ b/webroot/rsrc/js/application/diff/DiffChangesetList.js @@ -41,6 +41,12 @@ JX.install('DiffChangesetList', { 'click', ['differential-inline-comment', 'differential-inline-delete'], ondelete); + + var onreply = JX.bind(this, this._ifawake, this._onaction, 'reply'); + JX.Stratcom.listen( + 'click', + ['differential-inline-comment', 'differential-inline-reply'], + onreply); }, properties: { @@ -410,6 +416,9 @@ JX.install('DiffChangesetList', { case 'delete': inline.delete(is_ref); break; + case 'reply': + inline.reply(); + break; } }, diff --git a/webroot/rsrc/js/application/diff/DiffInline.js b/webroot/rsrc/js/application/diff/DiffInline.js index 9eaf177ca8..530f621caf 100644 --- a/webroot/rsrc/js/application/diff/DiffInline.js +++ b/webroot/rsrc/js/application/diff/DiffInline.js @@ -24,6 +24,7 @@ JX.install('DiffInline', { _displaySide: null, _isNewFile: null, _undoRow: null, + _replyToCommentPHID: null, _isDeleted: false, _isInvisible: false, @@ -66,23 +67,12 @@ JX.install('DiffInline', { }, bindToRange: function(data) { - this._id = null; - this._phid = null; - - this._hidden = false; - this._displaySide = data.displaySide; this._number = data.number; this._length = data.length; this._isNewFile = data.isNewFile; this._changesetID = data.changesetID; - var row = this._newRow(); - JX.Stratcom.getData(row).inline = this; - this._row = row; - - this.setInvisible(true); - // Insert the comment after any other comments which already appear on // the same row. var parent_row = JX.DOM.findAbove(data.target, 'tr'); @@ -90,8 +80,37 @@ JX.install('DiffInline', { while (target_row && JX.Stratcom.hasSigil(target_row, 'inline-row')) { target_row = target_row.nextSibling; } + + var row = this._newRow(); parent_row.parentNode.insertBefore(row, target_row); + this.setInvisible(true); + + return this; + }, + + bindToReply: function(inline) { + this._displaySide = inline._displaySide; + this._number = inline._number; + this._length = inline._length; + this._isNewFile = inline._isNewFile; + this._changesetID = inline._changesetID; + + this._replyToCommentPHID = inline._phid; + + // TODO: This should insert correctly into the thread, not just at the + // bottom. + var parent_row = inline._row; + var target_row = parent_row.nextSibling; + while (target_row && JX.Stratcom.hasSigil(target_row, 'inline-row')) { + target_row = target_row.nextSibling; + } + + var row = this._newRow(); + parent_row.parentNode.insertBefore(row, target_row); + + this.setInvisible(true); + return this; }, @@ -100,7 +119,16 @@ JX.install('DiffInline', { sigil: 'inline-row' }; - return JX.$N('tr', attributes); + var row = JX.$N('tr', attributes); + + JX.Stratcom.getData(row).inline = this; + this._row = row; + + this._id = null; + this._phid = null; + this._hidden = false; + + return row; }, setHidden: function(hidden) { @@ -172,6 +200,11 @@ JX.install('DiffInline', { .send(); }, + reply: function() { + var changeset = this.getChangeset(); + return changeset.newInlineReply(this); + }, + edit: function() { var uri = this._getInlineURI(); var handler = JX.bind(this, this._oneditresponse); @@ -238,6 +271,10 @@ JX.install('DiffInline', { return this._changesetID; }, + getReplyToCommentPHID: function() { + return this._replyToCommentPHID; + }, + setDeleted: function(deleted) { this._isDeleted = deleted; this._redraw(); @@ -266,7 +303,7 @@ JX.install('DiffInline', { length: this.getLineLength(), is_new: this.isNewFile(), changesetID: this.getChangesetID(), - replyToCommentPHID: '' + replyToCommentPHID: this.getReplyToCommentPHID() || '', }; }, diff --git a/webroot/rsrc/js/application/differential/DifferentialInlineCommentEditor.js b/webroot/rsrc/js/application/differential/DifferentialInlineCommentEditor.js deleted file mode 100644 index 7068e94c14..0000000000 --- a/webroot/rsrc/js/application/differential/DifferentialInlineCommentEditor.js +++ /dev/null @@ -1,360 +0,0 @@ -/** - * @provides differential-inline-comment-editor - * @requires javelin-dom - * javelin-util - * javelin-stratcom - * javelin-install - * javelin-request - * javelin-workflow - */ - -JX.install('DifferentialInlineCommentEditor', { - - construct : function(uri) { - this._uri = uri; - }, - - events : ['done'], - - members : { - _uri : null, - _undoText : null, - _completed: false, - _skipOverInlineCommentRows : function(node) { - // TODO: Move this semantic information out of class names. - while (node && node.className.indexOf('inline') !== -1) { - node = node.nextSibling; - } - return node; - }, - _buildRequestData : function() { - return { - op : this.getOperation(), - on_right : this.getOnRight(), - id : this.getID(), - number : this.getLineNumber(), - is_new : (this.getIsNew() ? 1 : 0), - length : this.getLength(), - changesetID : this.getChangesetID(), - text : this.getText() || '', - renderer: this.getRenderer(), - replyToCommentPHID: this.getReplyToCommentPHID() || '', - }; - }, - _draw : function(content, exact_row) { - var row = this.getRow(); - var table = this.getTable(); - var target = exact_row ? row : this._skipOverInlineCommentRows(row); - - function copyRows(dst, src, before) { - var rows = JX.DOM.scry(src, 'tr'); - for (var ii = 0; ii < rows.length; ii++) { - - // Find the table this