summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-11-02 07:54:39 -0800
committerShawn O. Pearce <sop@google.com>2009-11-02 07:54:39 -0800
commit019d67f8a82def3191102459ce8b36a8bc750f40 (patch)
tree97c4b6ed0265d1b49dd1403c1390c17423eac35d
parentc3befb4271e76e031c2f1775e0f999c43fd98542 (diff)
Clear message on publish comments screen after submitting
We were incorrectly saving the state of the publish comments screen after successfully submitting the comment. This allowed a user to press again "Publish Comments" on the same change, be presented with their prior message, and submit that same message a 2nd time, resulting in duplicate email and comments. Instead we discard the screen state if the comment was sent. Returning to the same screen now brings up an empty editor, making it harder for a user to submit the same message a 2nd time by mistake. Bug: issue 309 Change-Id: I763a6f78cf832ff6bc6906654e469c34a4d3cfe1 Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java b/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java
index 22bb1caecc..bac997a612 100644
--- a/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java
+++ b/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java
@@ -133,19 +133,15 @@ public class PublishCommentScreen extends AccountScreen implements ClickHandler
@Override
protected void onUnload() {
super.onUnload();
- if (saveStateOnUnload) {
- lastState = new SavedState(this);
- }
+ lastState = saveStateOnUnload ? new SavedState(this) : null;
}
@Override
public void onClick(final ClickEvent event) {
final Widget sender = (Widget) event.getSource();
if (send == sender) {
- lastState = null;
onSend();
} else if (cancel == sender) {
- lastState = null;
saveStateOnUnload = false;
goChange();
}
@@ -290,6 +286,7 @@ public class PublishCommentScreen extends AccountScreen implements ClickHandler
new HashSet<ApprovalCategoryValue.Id>(values.values()),
new GerritCallback<VoidResult>() {
public void onSuccess(final VoidResult result) {
+ saveStateOnUnload = false;
goChange();
}
});