From aabb791c174bc5f16f2cc0c783aa7fab8e3e3bc5 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 20 May 2017 05:33:59 -0700 Subject: [PATCH] (stable) When a user cancels a new inline, clear it from the objective list Summary: Ref T12733. Currently, creating a new inline and then canceling it leaves a marker in the objective list. Instead, remove the marker. Test Plan: - Created an empty inline, cancelled. Created a non-empty inline, cancelled. No objective marker in either case. - Created a new normal inline, objective marker. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12733 Differential Revision: https://secure.phabricator.com/D17979 --- resources/celerity/map.php | 12 ++++++------ webroot/rsrc/js/application/diff/DiffInline.js | 11 +++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 968862b535..402ae9013e 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -13,7 +13,7 @@ return array( 'core.pkg.js' => '599698a7', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => '7d4cfa59', - 'differential.pkg.js' => 'fc6a23eb', + 'differential.pkg.js' => 'd7e3edd5', 'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.js' => '84c8f8fd', 'favicon.ico' => '30672e08', @@ -392,7 +392,7 @@ return array( 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 'rsrc/js/application/diff/DiffChangeset.js' => 'cf4e2140', 'rsrc/js/application/diff/DiffChangesetList.js' => 'a716ca27', - 'rsrc/js/application/diff/DiffInline.js' => '93cbb03f', + 'rsrc/js/application/diff/DiffInline.js' => 'ca0fafde', 'rsrc/js/application/diff/ScrollObjective.js' => '9df4e4e2', 'rsrc/js/application/diff/ScrollObjectiveList.js' => '085dd101', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', @@ -779,7 +779,7 @@ return array( 'phabricator-dashboard-css' => 'fe5b1869', 'phabricator-diff-changeset' => 'cf4e2140', 'phabricator-diff-changeset-list' => 'a716ca27', - 'phabricator-diff-inline' => '93cbb03f', + 'phabricator-diff-inline' => 'ca0fafde', 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 'phabricator-draggable-list' => 'bea6e7f4', 'phabricator-fatal-config-template-css' => '8f18fa41', @@ -1604,9 +1604,6 @@ return array( 'javelin-stratcom', 'javelin-dom', ), - '93cbb03f' => array( - 'javelin-dom', - ), '93d0c9e3' => array( 'javelin-behavior', 'javelin-stratcom', @@ -1979,6 +1976,9 @@ return array( 'phabricator-shaped-request', 'conpherence-thread-manager', ), + 'ca0fafde' => array( + 'javelin-dom', + ), 'caade6f2' => array( 'javelin-behavior', 'javelin-request', diff --git a/webroot/rsrc/js/application/diff/DiffInline.js b/webroot/rsrc/js/application/diff/DiffInline.js index 77a0da3ec7..e7c18ef6ad 100644 --- a/webroot/rsrc/js/application/diff/DiffInline.js +++ b/webroot/rsrc/js/application/diff/DiffInline.js @@ -33,6 +33,7 @@ JX.install('DiffInline', { _isDraft: null, _isFixed: null, _isEditing: false, + _isNew: false, bindToRow: function(row) { this._row = row; @@ -73,6 +74,7 @@ JX.install('DiffInline', { this._isGhost = data.isGhost; this._changesetID = data.changesetID; + this._isNew = false; this.setInvisible(false); @@ -87,6 +89,7 @@ JX.install('DiffInline', { this._length = parseInt(data.length, 10); this._isNewFile = data.isNewFile; this._changesetID = data.changesetID; + this._isNew = true; // Insert the comment after any other comments which already appear on // the same row. @@ -110,6 +113,7 @@ JX.install('DiffInline', { this._length = inline._length; this._isNewFile = inline._isNewFile; this._changesetID = inline._changesetID; + this._isNew = true; this._replyToCommentPHID = inline._phid; @@ -198,6 +202,13 @@ JX.install('DiffInline', { return; } + // If this is a new comment which we aren't editing, don't show anything: + // the use started a comment or reply, then cancelled it. + if (this._isNew && !this._isEditing) { + objective.hide(); + return; + } + var changeset = this.getChangeset(); if (!changeset.isVisible()) { objective.hide();