• Fatih Acet's avatar
    Merge branch 'new-branch-check-fix' into 'master' · 70c0d87a
    Fatih Acet authored
    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
    70c0d87a
To find the state of this project's repository at the time of any of these versions, check out the tags.
CHANGELOG 159 KB