1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 07:50:57 +01:00

When a user hits "Reply", then "Cancel" on an inline comment (without typing),

don't show "Undo"

Summary: When a user hits "Reply" on an inline comment, doesn't type anything,
and then hits "Cancel", we incorrectly store the text of the comment the user is
replying to as the "original" text, and then detect that they've changed it when
they immediately cancel. Instead, store empty string as the original text.

Test Plan:
  - Hit "Reply" and then "Cancel" on an inline comment. No undo now.
  - Hit "Reply", typed some text, and then hit "Cancel". Got an undo which
restored my text.

Reviewers: tomo, jungejason, tuomaspelkonen, aran

Reviewed By: aran

CC: aran, tomo

Differential Revision: 879
This commit is contained in:
epriestley 2011-08-31 11:28:48 -07:00
parent b2b677d446
commit c544f78015
2 changed files with 28 additions and 21 deletions

View file

@ -451,7 +451,7 @@ celerity_register_resource_map(array(
), ),
'javelin-behavior-differential-edit-inline-comments' => 'javelin-behavior-differential-edit-inline-comments' =>
array( array(
'uri' => '/res/9d4ca5d7/rsrc/js/application/differential/behavior-edit-inline-comments.js', 'uri' => '/res/af3bf064/rsrc/js/application/differential/behavior-edit-inline-comments.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -1427,20 +1427,6 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/3f2092d7/differential.pkg.css', 'uri' => '/res/pkg/3f2092d7/differential.pkg.css',
'type' => 'css', 'type' => 'css',
), ),
'66a154fc' =>
array(
'name' => 'differential.pkg.js',
'symbols' =>
array(
0 => 'javelin-behavior-differential-feedback-preview',
1 => 'javelin-behavior-differential-edit-inline-comments',
2 => 'javelin-behavior-differential-populate',
3 => 'javelin-behavior-differential-show-more',
4 => 'javelin-behavior-differential-diff-radios',
),
'uri' => '/res/pkg/66a154fc/differential.pkg.js',
'type' => 'js',
),
'95c67dcd' => '95c67dcd' =>
array( array(
'name' => 'workflow.pkg.js', 'name' => 'workflow.pkg.js',
@ -1457,6 +1443,20 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/95c67dcd/workflow.pkg.js', 'uri' => '/res/pkg/95c67dcd/workflow.pkg.js',
'type' => 'js', 'type' => 'js',
), ),
'982ad44b' =>
array(
'name' => 'differential.pkg.js',
'symbols' =>
array(
0 => 'javelin-behavior-differential-feedback-preview',
1 => 'javelin-behavior-differential-edit-inline-comments',
2 => 'javelin-behavior-differential-populate',
3 => 'javelin-behavior-differential-show-more',
4 => 'javelin-behavior-differential-diff-radios',
),
'uri' => '/res/pkg/982ad44b/differential.pkg.js',
'type' => 'js',
),
'ac869011' => 'ac869011' =>
array( array(
'name' => 'typeahead.pkg.js', 'name' => 'typeahead.pkg.js',
@ -1521,11 +1521,11 @@ celerity_register_resource_map(array(
'javelin-behavior' => '3dbf4083', 'javelin-behavior' => '3dbf4083',
'javelin-behavior-aphront-basic-tokenizer' => 'ac869011', 'javelin-behavior-aphront-basic-tokenizer' => 'ac869011',
'javelin-behavior-aphront-form-disable-on-submit' => '95c67dcd', 'javelin-behavior-aphront-form-disable-on-submit' => '95c67dcd',
'javelin-behavior-differential-diff-radios' => '66a154fc', 'javelin-behavior-differential-diff-radios' => '982ad44b',
'javelin-behavior-differential-edit-inline-comments' => '66a154fc', 'javelin-behavior-differential-edit-inline-comments' => '982ad44b',
'javelin-behavior-differential-feedback-preview' => '66a154fc', 'javelin-behavior-differential-feedback-preview' => '982ad44b',
'javelin-behavior-differential-populate' => '66a154fc', 'javelin-behavior-differential-populate' => '982ad44b',
'javelin-behavior-differential-show-more' => '66a154fc', 'javelin-behavior-differential-show-more' => '982ad44b',
'javelin-behavior-phabricator-keyboard-shortcuts' => '95c67dcd', 'javelin-behavior-phabricator-keyboard-shortcuts' => '95c67dcd',
'javelin-behavior-workflow' => '95c67dcd', 'javelin-behavior-workflow' => '95c67dcd',
'javelin-dom' => '3dbf4083', 'javelin-dom' => '3dbf4083',

View file

@ -186,12 +186,19 @@ JX.behavior('differential-edit-inline-comments', function(config) {
var node = e.getNode('differential-inline-comment'); var node = e.getNode('differential-inline-comment');
var row = node.parentNode.parentNode; var row = node.parentNode.parentNode;
var original = data.original;
if (op == 'reply') {
// If the user hit "reply", the original text is empty (a new reply), not
// the text of the comment they're replying to.
original = '';
}
editor = new JX.DifferentialInlineCommentEditor(config.uri) editor = new JX.DifferentialInlineCommentEditor(config.uri)
.setTemplates(config.undo_templates) .setTemplates(config.undo_templates)
.setOperation(op) .setOperation(op)
.setID(data.id) .setID(data.id)
.setOnRight(data.on_right) .setOnRight(data.on_right)
.setOriginalText(data.original) .setOriginalText(original)
.setRow(row) .setRow(row)
.setTable(row.parentNode) .setTable(row.parentNode)
.start(); .start();