diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-10-26 01:28:10 +0000 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-10-26 01:28:10 +0000 |
commit | 052480ae53afa112e744674a16ff57aa367b1d0d (patch) | |
tree | c2998fffd9b4d4142da061eee8b8d93ba40cb54c /app/assets/javascripts/application.js | |
parent | d6e72f617237274f38f7e59fac9889d796692008 (diff) | |
parent | 0dcdd43544a3111c6addb7f2d3af3b6a66e1ad2f (diff) | |
download | gitlab-ce-052480ae53afa112e744674a16ff57aa367b1d0d.tar.gz |
Merge branch 'replace-jquery-cookie-plugin' into 'master'
Replace jquery-cookie plugin with js-cookie
## What does this MR do?
Removes an outdated and unmaintained dependency [jquery.cookie](https://github.com/carhartl/jquery-cookie) with its successor [js.cookie](https://github.com/js-cookie/js-cookie) which is not dependent on jQuery.
Also this MR adds a global default cookie `path` setting which defaults to the GitLab root directory. Now, setting a cookie to any path other than `gon.relative_url_root` requires an explicit opt-out. This is a sensible default and should prevent accidental omission going forward.
## Are there points in the code the reviewer needs to double check?
Double check that all instances of `$.cookie(x)` have been replaced by `Cookies.get(x)` and all instances of `$.cookie(x, y, z)` are replaced with `Cookies.set(x, y, z)`. All javascripts which set or retrieve cookie values should function just as before.
## Why was this MR needed?
One more step toward shaking off jQuery as a dependency (#23022), also [jquery.cookie](https://github.com/carhartl/jquery-cookie) is no longer maintained and hasn't seen an update in 2+ years.
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added
- Tests
- [x] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
## What are the relevant issue numbers?
#23022
See merge request !7085
Diffstat (limited to 'app/assets/javascripts/application.js')
-rw-r--r-- | app/assets/javascripts/application.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c6c3c82e1ee..879f90bdc05 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,13 +11,13 @@ /*= require jquery-ui/effect-highlight */ /*= require jquery-ui/sortable */ /*= require jquery_ujs */ -/*= require jquery.cookie */ /*= require jquery.endless-scroll */ /*= require jquery.highlight */ /*= require jquery.waitforimages */ /*= require jquery.atwho */ /*= require jquery.scrollTo */ /*= require jquery.turbolinks */ +/*= require js.cookie */ /*= require turbolinks */ /*= require autosave */ /*= require bootstrap/affix */ @@ -145,6 +145,10 @@ $document = $(document); $window = $(window); $body = $('body'); + + // Set the default path for all cookies to GitLab's root directory + Cookies.defaults.path = gon.relative_url_root || '/'; + gl.utils.preventDisabledButtons(); bootstrapBreakpoint = bp.getBreakpointSize(); $(".nav-sidebar").niceScroll({ |