summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-03-27 11:00:54 +0100
committerDouwe Maan <douwe@gitlab.com>2015-03-27 16:55:18 +0100
commit7a70fb123c0a21e1180665c9b28b8483d2c66a3e (patch)
tree4498c10f76be29e5305186685fd0508d73efba5d
parent28592ae46767443dc0f3723bd4f05f360bab8f41 (diff)
downloadgitlab-ce-7a70fb123c0a21e1180665c9b28b8483d2c66a3e.tar.gz
Prevent holding Control-Enter or Command-Enter from posting comment multiple times.
-rw-r--r--CHANGELOG1
-rw-r--r--app/assets/javascripts/notes.js.coffee1
2 files changed, 2 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 06b7413e616..04d889456dd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -46,6 +46,7 @@ v 7.10.0 (unreleased)
- Refactor issue filtering
- AJAX selectbox for issue assignee and author filters
- Fix issue with missing options in issue filtering dropdown if selected one
+ - Prevent holding Control-Enter or Command-Enter from posting comment multiple times.
v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted.
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index c366c98cf54..b61c4dd6544 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -57,6 +57,7 @@ class @Notes
@notes_forms = '.js-main-target-form textarea, .js-discussion-note-form textarea'
# Chrome doesn't fire keypress or keyup for Command+Enter, so we need keydown.
$(document).on('keydown', @notes_forms, (e) ->
+ return if e.originalEvent.repeat
if e.keyCode == 10 || ((e.metaKey || e.ctrlKey) && e.keyCode == 13)
$(@).parents('form').submit()
)