Merge branch 'fix-cannot-move-project-error' into 'master'

Fix "Cannot move project" error message from popping up after a successful transfer

The JavaScript click handlers were never being removed, leading to duplicate requests when attempting to transfer a project to another namespace. The first transfer would succeed but the subsequent ones would fail, leading to the error message saying, "Cannot move project".

![image](https://gitlab.com/stanhu/gitlab-ce/uploads/0c9f61294291514e0c2a48c204b6a1aa/image.png)

I attempted to write a unit test for this, but it was taking me too long to get it right.

Closes #1448 and #1128

See merge request !548
This commit is contained in:
Douwe Maan 2015-04-21 09:29:17 +00:00
commit 2400181a3a
3 changed files with 4 additions and 1 deletions

View file

@ -3,7 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.11.0 (unreleased) v 7.11.0 (unreleased)
- Fix clone URL field and X11 Primary selection (Dmitry Medvinsky) - Fix clone URL field and X11 Primary selection (Dmitry Medvinsky)
- Ignore invalid lines in .gitmodules - Ignore invalid lines in .gitmodules
- - Fix "Cannot move project" error message from popping up after a successful transfer (Stan Hu)
- -
- -
- -

View file

@ -173,6 +173,7 @@ $ ->
$(@).closest(".diff-file").find(".notes_holder").toggle() $(@).closest(".diff-file").find(".notes_holder").toggle()
e.preventDefault() e.preventDefault()
$(document).off "click", '.js-confirm-danger'
$(document).on "click", '.js-confirm-danger', (e) -> $(document).on "click", '.js-confirm-danger', (e) ->
e.preventDefault() e.preventDefault()
btn = $(e.target) btn = $(e.target)

View file

@ -8,11 +8,13 @@ class @ConfirmDangerModal
submit = $('.js-confirm-danger-submit') submit = $('.js-confirm-danger-submit')
submit.disable() submit.disable()
$('.js-confirm-danger-input').off 'input'
$('.js-confirm-danger-input').on 'input', -> $('.js-confirm-danger-input').on 'input', ->
if rstrip($(@).val()) is project_path if rstrip($(@).val()) is project_path
submit.enable() submit.enable()
else else
submit.disable() submit.disable()
$('.js-confirm-danger-submit').off 'click'
$('.js-confirm-danger-submit').on 'click', => $('.js-confirm-danger-submit').on 'click', =>
@form.submit() @form.submit()