mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
When cancelling an unsaved editing inline after a reload, don't cancel into an empty state
Summary: Ref T13513. Overloading "original text" to get "edit-on-load" comments into the right state has some undesirable side effects. Instead, provide the text when the editor opens. This fixes a cancel interaction. Test Plan: - Create an inline, type text, don't save. - Reload page. - Cancel. - Before: cancelled into empty state. - After: cancelled into deleted+undo state. Maniphest Tasks: T13513 Differential Revision: https://secure.phabricator.com/D21219
This commit is contained in:
parent
7fa47408a3
commit
07e160bde1
5 changed files with 17 additions and 11 deletions
|
@ -13,7 +13,7 @@ return array(
|
|||
'core.pkg.js' => '632fb8f5',
|
||||
'dark-console.pkg.js' => '187792c2',
|
||||
'differential.pkg.css' => '2d70b7b9',
|
||||
'differential.pkg.js' => 'e6da9e6f',
|
||||
'differential.pkg.js' => '22ec6f26',
|
||||
'diffusion.pkg.css' => '42c75c37',
|
||||
'diffusion.pkg.js' => 'a98c0bf7',
|
||||
'maniphest.pkg.css' => '35995d6d',
|
||||
|
@ -381,7 +381,7 @@ return array(
|
|||
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
|
||||
'rsrc/js/application/diff/DiffChangeset.js' => 'a49dc31e',
|
||||
'rsrc/js/application/diff/DiffChangesetList.js' => '6992b85c',
|
||||
'rsrc/js/application/diff/DiffInline.js' => 'e6b9b4f3',
|
||||
'rsrc/js/application/diff/DiffInline.js' => 'db754a7b',
|
||||
'rsrc/js/application/diff/DiffPathView.js' => '8207abf9',
|
||||
'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b',
|
||||
'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17',
|
||||
|
@ -778,7 +778,7 @@ return array(
|
|||
'phabricator-dashboard-css' => '5a205b9d',
|
||||
'phabricator-diff-changeset' => 'a49dc31e',
|
||||
'phabricator-diff-changeset-list' => '6992b85c',
|
||||
'phabricator-diff-inline' => 'e6b9b4f3',
|
||||
'phabricator-diff-inline' => 'db754a7b',
|
||||
'phabricator-diff-path-view' => '8207abf9',
|
||||
'phabricator-diff-tree-view' => '5d83623b',
|
||||
'phabricator-drag-and-drop-file-upload' => '4370900d',
|
||||
|
@ -2113,6 +2113,9 @@ return array(
|
|||
'javelin-uri',
|
||||
'phabricator-notification',
|
||||
),
|
||||
'db754a7b' => array(
|
||||
'javelin-dom',
|
||||
),
|
||||
'e150bd50' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
@ -2132,9 +2135,6 @@ return array(
|
|||
'javelin-dom',
|
||||
'phabricator-draggable-list',
|
||||
),
|
||||
'e6b9b4f3' => array(
|
||||
'javelin-dom',
|
||||
),
|
||||
'e8240b50' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
|
|
@ -211,6 +211,14 @@ abstract class PhabricatorInlineCommentController
|
|||
}
|
||||
|
||||
$this->saveComment($inline);
|
||||
|
||||
if (strlen($text)) {
|
||||
$this->purgeVersionedDrafts($inline);
|
||||
}
|
||||
|
||||
PhabricatorInlineComment::loadAndAttachVersionedDrafts(
|
||||
$viewer,
|
||||
array($inline));
|
||||
}
|
||||
|
||||
$edit_dialog = $this->buildEditDialog($inline)
|
||||
|
|
|
@ -109,7 +109,7 @@ final class PHUIDiffInlineCommentEditView
|
|||
$viewer = $this->getViewer();
|
||||
$inline = $this->getInlineComment();
|
||||
|
||||
$text = $inline->getContent();
|
||||
$text = $inline->getContentForEdit($viewer);
|
||||
|
||||
return id(new PhabricatorRemarkupControl())
|
||||
->setViewer($viewer)
|
||||
|
|
|
@ -75,8 +75,6 @@ abstract class PHUIDiffInlineCommentView extends AphrontView {
|
|||
break;
|
||||
}
|
||||
|
||||
$original_text = $inline->getContentForEdit($viewer);
|
||||
|
||||
return array(
|
||||
'id' => $inline->getID(),
|
||||
'phid' => $inline->getPHID(),
|
||||
|
@ -84,7 +82,7 @@ abstract class PHUIDiffInlineCommentView extends AphrontView {
|
|||
'number' => $inline->getLineNumber(),
|
||||
'length' => $inline->getLineLength(),
|
||||
'isNewFile' => (bool)$inline->getIsNewFile(),
|
||||
'original' => $original_text,
|
||||
'original' => $inline->getContent(),
|
||||
'replyToCommentPHID' => $inline->getReplyToCommentPHID(),
|
||||
'isDraft' => $inline->isDraft(),
|
||||
'isFixed' => $is_fixed,
|
||||
|
|
|
@ -96,7 +96,7 @@ JX.install('DiffInline', {
|
|||
// which we're currently editing. This flow is a little clumsy, but
|
||||
// reasonable until some future change moves away from "send down
|
||||
// the inline, then immediately click edit".
|
||||
this.edit(this._originalText, true);
|
||||
this.edit(null, true);
|
||||
} else {
|
||||
this.setInvisible(false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue