Commit 70c0d87a authored by Fatih Acet's avatar Fatih Acet

Merge branch 'new-branch-check-fix' into 'master'

Fix check for existence of New Branch button on Issue page

## What does this MR do?

The condition in [`initCanCreateBranch`][initCanCreateBranch] mistakenly checks `$container` (the New Branch button) for falsy. However JQuery returns an empty array if no matching element was found, so this condition is never met.

## Why was this MR needed?

The wrong condition causes:
* `$.getJSON($container.data('path'))` to be called where `$container.data('path')` is `undefined`
* in this case `$.getJSON` uses `location.href`
* if the current page has a JSON representation, it is fetched and cached by browser and displayed the next time the page is visited (#17365)
* otherwise "Failed to check if new branch can be created" is displayed (#17264)

## What are the relevant issue numbers?

Fixes #17264 and #17365.

[initCanCreateBranch]: https://gitlab.com/gitlab-org/gitlab-ce/blob/v8.8.4/app/assets/javascripts/issue.js.coffee#L102


See merge request !4630
parents 89506940 87fcb0ab
......@@ -5,6 +5,7 @@ v 8.10.0 (unreleased)
- Wrap code blocks on Activies and Todos page. !4783 (winniehell)
- Add Sidekiq queue duration to transaction metrics.
- Make images fit to the size of the viewport !4810
- Fix check for New Branch button on Issue page !4630 (winniehell)
- Fix MR-auto-close text added to description. !4836
- Fix pagination when sorting by columns with lots of ties (like priority)
- Exclude email check from the standard health check
......
......@@ -99,7 +99,7 @@ class @Issue
# If the user doesn't have the required permissions the container isn't
# rendered at all.
return unless $container
return if $container.length is 0
$.getJSON($container.data('path'))
.error ->
......
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