Commit dd406a71 authored by Jacob Schatz's avatar Jacob Schatz Committed by Ruben Davila

Merge branch '22020-fix-form-submit-missing-url' into 'master'

Add missing url param to ajax call

The `url` param was missing from the ajax call.

This bug happened because the `url` param was not set. jQuery defaults to `location.href`. BUT if the user came to the protected branches page from another page a previously set `ajaxSettings.url` was used as default url (which defaults to `location.href`) so when the user submitted the form the request was made to a  completely wrong `url`. Refreshing the page was working because `ajaxSettings.url` was set to the current page'`location.href` and that was the correct URL.

This MR ensures the url will always be set with the right one.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/22020

See merge request !760
parent 3a11c2fc
......@@ -3,6 +3,11 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.12.2
v 8.12.1 (unreleased)
v 8.12.2 (unreleased)
- Fix bug when protecting a branch due to missing url paramenter in request !760
- Ignore unknown project ID in RepositoryUpdateMirrorWorker
v 8.12.1
- Prevent secrets to be pushed to the repository
v 8.12.0
......
......@@ -93,7 +93,8 @@
e.preventDefault();
$.ajax({
method: 'POST',
url: this.$form.attr('action'),
method: this.$form.attr('method'),
data: this.getFormData()
})
.success(() => {
......
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