summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-06-27 16:59:05 +0000
committerFatih Acet <acetfatih@gmail.com>2016-06-27 16:59:05 +0000
commit70c0d87a5eaf428ac996008f842644a1dcd89088 (patch)
tree4d9e7e5f16152bb244836177abcdb2c6d5e1aa40
parent89506940f42c983ac8f9f3730330c996f5f621e4 (diff)
parent87fcb0abcb36400bb1dc5415d9de3f658e3e43c2 (diff)
downloadgitlab-ce-70c0d87a5eaf428ac996008f842644a1dcd89088.tar.gz
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
-rw-r--r--CHANGELOG1
-rw-r--r--app/assets/javascripts/issue.js.coffee2
2 files changed, 2 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index f9752eebc2d..840ef73f742 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
diff --git a/app/assets/javascripts/issue.js.coffee b/app/assets/javascripts/issue.js.coffee
index 157361404e0..f446aa49cde 100644
--- a/app/assets/javascripts/issue.js.coffee
+++ b/app/assets/javascripts/issue.js.coffee
@@ -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 ->