summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-01-14 13:14:50 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-01-14 13:14:50 +0000
commite47f0e563d127f593f16c0a521c836e21bceb77f (patch)
tree4ad90625793e6acaa96390f68bb7290b5b64fd39
parent620d8b68a15f9c20b134f79e40f81711578773e6 (diff)
parent1eb3e8acb61e837768d3aea93ae28b819efb9702 (diff)
downloadgitlab-ce-e47f0e563d127f593f16c0a521c836e21bceb77f.tar.gz
Merge branch 'closing-mr-bug-fix' into 'master'
fixes bug with commenting on merge requests See merge request !2415
-rw-r--r--app/assets/javascripts/merge_request.js.coffee13
-rw-r--r--app/assets/javascripts/notes.js.coffee4
2 files changed, 11 insertions, 6 deletions
diff --git a/app/assets/javascripts/merge_request.js.coffee b/app/assets/javascripts/merge_request.js.coffee
index ed0bf2b3f48..1f46e331427 100644
--- a/app/assets/javascripts/merge_request.js.coffee
+++ b/app/assets/javascripts/merge_request.js.coffee
@@ -48,14 +48,15 @@ class @MergeRequest
_this = @
$('a.btn-close, a.btn-reopen').on 'click', (e) ->
$this = $(this)
- if $this.data('submitted')
- return
- e.preventDefault()
- e.stopImmediatePropagation()
shouldSubmit = $this.hasClass('btn-comment')
- console.log("shouldSubmit")
+ if shouldSubmit && $this.data('submitted')
+ return
if shouldSubmit
- _this.submitNoteForm($this.closest('form'),$this)
+ if $this.hasClass('btn-comment-and-close') || $this.hasClass('btn-comment-and-reopen')
+ e.preventDefault()
+ e.stopImmediatePropagation()
+ _this.submitNoteForm($this.closest('form'),$this)
+
submitNoteForm: (form, $button) =>
noteText = form.find("textarea.js-note-text").val()
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 8ba00ecbbab..fcf50dd1b51 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -521,9 +521,13 @@ class @Notes
if textarea.val().trim().length > 0
form.find('.js-note-target-reopen').text('Comment & reopen')
form.find('.js-note-target-close').text('Comment & close')
+ form.find('.js-note-target-reopen').addClass('btn-comment-and-reopen')
+ form.find('.js-note-target-close').addClass('btn-comment-and-close')
else
form.find('.js-note-target-reopen').text('Reopen')
form.find('.js-note-target-close').text('Close')
+ form.find('.js-note-target-reopen').removeClass('btn-comment-and-reopen')
+ form.find('.js-note-target-close').removeClass('btn-comment-and-close')
initTaskList: ->
@enableTaskList()