Commit 671be8a8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ctrl-enter-multiple-comments' into 'master'

Prevent holding Control-Enter or Command-Enter from posting comment multiple times.

See private issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2184

See merge request !467
parents 7869e258 7a70fb12
...@@ -46,6 +46,7 @@ v 7.10.0 (unreleased) ...@@ -46,6 +46,7 @@ v 7.10.0 (unreleased)
- Refactor issue filtering - Refactor issue filtering
- AJAX selectbox for issue assignee and author filters - AJAX selectbox for issue assignee and author filters
- Fix issue with missing options in issue filtering dropdown if selected one - 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 v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted. - Send EmailsOnPush email when branch or tag is created or deleted.
......
...@@ -57,6 +57,7 @@ class @Notes ...@@ -57,6 +57,7 @@ class @Notes
@notes_forms = '.js-main-target-form textarea, .js-discussion-note-form textarea' @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. # Chrome doesn't fire keypress or keyup for Command+Enter, so we need keydown.
$(document).on('keydown', @notes_forms, (e) -> $(document).on('keydown', @notes_forms, (e) ->
return if e.originalEvent.repeat
if e.keyCode == 10 || ((e.metaKey || e.ctrlKey) && e.keyCode == 13) if e.keyCode == 10 || ((e.metaKey || e.ctrlKey) && e.keyCode == 13)
$(@).parents('form').submit() $(@).parents('form').submit()
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment