Skip to content

Commit c544f78

Browse files
author
epriestley
committed
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
1 parent b2b677d commit c544f78

File tree

2 files changed

+28
-21
lines changed

2 files changed

+28
-21
lines changed

src/__celerity_resource_map__.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@
451451
),
452452
'javelin-behavior-differential-edit-inline-comments' =>
453453
array(
454-
'uri' => '/res/9d4ca5d7/rsrc/js/application/differential/behavior-edit-inline-comments.js',
454+
'uri' => '/res/af3bf064/rsrc/js/application/differential/behavior-edit-inline-comments.js',
455455
'type' => 'js',
456456
'requires' =>
457457
array(
@@ -1427,20 +1427,6 @@
14271427
'uri' => '/res/pkg/3f2092d7/differential.pkg.css',
14281428
'type' => 'css',
14291429
),
1430-
'66a154fc' =>
1431-
array(
1432-
'name' => 'differential.pkg.js',
1433-
'symbols' =>
1434-
array(
1435-
0 => 'javelin-behavior-differential-feedback-preview',
1436-
1 => 'javelin-behavior-differential-edit-inline-comments',
1437-
2 => 'javelin-behavior-differential-populate',
1438-
3 => 'javelin-behavior-differential-show-more',
1439-
4 => 'javelin-behavior-differential-diff-radios',
1440-
),
1441-
'uri' => '/res/pkg/66a154fc/differential.pkg.js',
1442-
'type' => 'js',
1443-
),
14441430
'95c67dcd' =>
14451431
array(
14461432
'name' => 'workflow.pkg.js',
@@ -1457,6 +1443,20 @@
14571443
'uri' => '/res/pkg/95c67dcd/workflow.pkg.js',
14581444
'type' => 'js',
14591445
),
1446+
'982ad44b' =>
1447+
array(
1448+
'name' => 'differential.pkg.js',
1449+
'symbols' =>
1450+
array(
1451+
0 => 'javelin-behavior-differential-feedback-preview',
1452+
1 => 'javelin-behavior-differential-edit-inline-comments',
1453+
2 => 'javelin-behavior-differential-populate',
1454+
3 => 'javelin-behavior-differential-show-more',
1455+
4 => 'javelin-behavior-differential-diff-radios',
1456+
),
1457+
'uri' => '/res/pkg/982ad44b/differential.pkg.js',
1458+
'type' => 'js',
1459+
),
14601460
'ac869011' =>
14611461
array(
14621462
'name' => 'typeahead.pkg.js',
@@ -1521,11 +1521,11 @@
15211521
'javelin-behavior' => '3dbf4083',
15221522
'javelin-behavior-aphront-basic-tokenizer' => 'ac869011',
15231523
'javelin-behavior-aphront-form-disable-on-submit' => '95c67dcd',
1524-
'javelin-behavior-differential-diff-radios' => '66a154fc',
1525-
'javelin-behavior-differential-edit-inline-comments' => '66a154fc',
1526-
'javelin-behavior-differential-feedback-preview' => '66a154fc',
1527-
'javelin-behavior-differential-populate' => '66a154fc',
1528-
'javelin-behavior-differential-show-more' => '66a154fc',
1524+
'javelin-behavior-differential-diff-radios' => '982ad44b',
1525+
'javelin-behavior-differential-edit-inline-comments' => '982ad44b',
1526+
'javelin-behavior-differential-feedback-preview' => '982ad44b',
1527+
'javelin-behavior-differential-populate' => '982ad44b',
1528+
'javelin-behavior-differential-show-more' => '982ad44b',
15291529
'javelin-behavior-phabricator-keyboard-shortcuts' => '95c67dcd',
15301530
'javelin-behavior-workflow' => '95c67dcd',
15311531
'javelin-dom' => '3dbf4083',

webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,19 @@ JX.behavior('differential-edit-inline-comments', function(config) {
186186
var node = e.getNode('differential-inline-comment');
187187
var row = node.parentNode.parentNode;
188188

189+
var original = data.original;
190+
if (op == 'reply') {
191+
// If the user hit "reply", the original text is empty (a new reply), not
192+
// the text of the comment they're replying to.
193+
original = '';
194+
}
195+
189196
editor = new JX.DifferentialInlineCommentEditor(config.uri)
190197
.setTemplates(config.undo_templates)
191198
.setOperation(op)
192199
.setID(data.id)
193200
.setOnRight(data.on_right)
194-
.setOriginalText(data.original)
201+
.setOriginalText(original)
195202
.setRow(row)
196203
.setTable(row.parentNode)
197204
.start();

0 commit comments

Comments
 (0)