Commit f8520f5d authored by Mike Greiling's avatar Mike Greiling

remove manual Cookie.set "path" option in favor of global setting

parent 1c0213f2
...@@ -24,9 +24,7 @@ ...@@ -24,9 +24,7 @@
var filter = sender.attr("id").split("_")[0]; var filter = sender.attr("id").split("_")[0];
$('.event-filter .active').removeClass("active"); $('.event-filter .active').removeClass("active");
Cookies.set("event_filter", filter, { Cookies.set("event_filter", filter);
path: gon.relative_url_root || '/'
});
sender.closest('li').toggleClass("active"); sender.closest('li').toggleClass("active");
}; };
......
...@@ -322,10 +322,7 @@ ...@@ -322,10 +322,7 @@
var frequentlyUsedEmojis; var frequentlyUsedEmojis;
frequentlyUsedEmojis = this.getFrequentlyUsedEmojis(); frequentlyUsedEmojis = this.getFrequentlyUsedEmojis();
frequentlyUsedEmojis.push(emoji); frequentlyUsedEmojis.push(emoji);
Cookies.set('frequently_used_emojis', frequentlyUsedEmojis.join(','), { Cookies.set('frequently_used_emojis', frequentlyUsedEmojis.join(','), { expires: 365 });
path: gon.relative_url_root || '/',
expires: 365
});
}; };
AwardsHandler.prototype.getFrequentlyUsedEmojis = function() { AwardsHandler.prototype.getFrequentlyUsedEmojis = function() {
......
...@@ -75,9 +75,7 @@ ...@@ -75,9 +75,7 @@
dismissLanding() { dismissLanding() {
store.isHelpDismissed = true; store.isHelpDismissed = true;
Cookies.set(COOKIE_NAME, true, { Cookies.set(COOKIE_NAME, true);
path: gon.relative_url_root || '/'
});
} }
initDropdown() { initDropdown() {
......
...@@ -180,9 +180,7 @@ ...@@ -180,9 +180,7 @@
this.state.diffView = viewType; this.state.diffView = viewType;
this.state.isParallel = viewType === VIEW_TYPES.PARALLEL; this.state.isParallel = viewType === VIEW_TYPES.PARALLEL;
Cookies.set('diff_view', viewType, { Cookies.set('diff_view', viewType);
path: gon.relative_url_root || '/'
});
}, },
getHeadHeaderLine(id) { getHeadHeaderLine(id) {
......
...@@ -23,16 +23,12 @@ ...@@ -23,16 +23,12 @@
return $(this).parents('form').submit(); return $(this).parents('form').submit();
}); });
$('.hide-no-ssh-message').on('click', function(e) { $('.hide-no-ssh-message').on('click', function(e) {
Cookies.set('hide_no_ssh_message', 'false', { Cookies.set('hide_no_ssh_message', 'false');
path: gon.relative_url_root || '/'
});
$(this).parents('.no-ssh-key-message').remove(); $(this).parents('.no-ssh-key-message').remove();
return e.preventDefault(); return e.preventDefault();
}); });
$('.hide-no-password-message').on('click', function(e) { $('.hide-no-password-message').on('click', function(e) {
Cookies.set('hide_no_password_message', 'false', { Cookies.set('hide_no_password_message', 'false');
path: gon.relative_url_root || '/'
});
$(this).parents('.no-password-message').remove(); $(this).parents('.no-password-message').remove();
return e.preventDefault(); return e.preventDefault();
}); });
......
...@@ -29,9 +29,7 @@ ...@@ -29,9 +29,7 @@
$('.page-with-sidebar').removeClass('right-sidebar-collapsed').addClass('right-sidebar-expanded'); $('.page-with-sidebar').removeClass('right-sidebar-collapsed').addClass('right-sidebar-expanded');
} }
if (!triggered) { if (!triggered) {
return Cookies.set("collapsed_gutter", $('.right-sidebar').hasClass('right-sidebar-collapsed'), { return Cookies.set("collapsed_gutter", $('.right-sidebar').hasClass('right-sidebar-collapsed'));
path: gon.relative_url_root || '/'
});
} }
}); });
return $(document).off('click', '.js-issuable-todo').on('click', '.js-issuable-todo', this.toggleTodo); return $(document).off('click', '.js-issuable-todo').on('click', '.js-issuable-todo', this.toggleTodo);
......
...@@ -62,10 +62,7 @@ ...@@ -62,10 +62,7 @@
if (!this.isPinned) { if (!this.isPinned) {
this.isExpanded = false; this.isExpanded = false;
} }
Cookies.set(pinnedStateCookie, this.isPinned ? 'true' : 'false', { Cookies.set(pinnedStateCookie, this.isPinned ? 'true' : 'false', { expires: 3650 });
path: gon.relative_url_root || '/',
expires: 3650
});
this.renderState(); this.renderState();
} }
......
...@@ -23,10 +23,7 @@ ...@@ -23,10 +23,7 @@
hideProjectLimitMessage() { hideProjectLimitMessage() {
$('.hide-project-limit-message').on('click', e => { $('.hide-project-limit-message').on('click', e => {
e.preventDefault(); e.preventDefault();
const path = gon.relative_url_root || '/'; Cookies.set('hide_project_limit_message', 'false');
Cookies.set('hide_project_limit_message', 'false', {
path: path
});
$(this).parents('.project-limit-message').remove(); $(this).parents('.project-limit-message').remove();
}); });
} }
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
spyOn(jQuery, 'get').and.callFake(function(req, cb) { spyOn(jQuery, 'get').and.callFake(function(req, cb) {
return cb(window.emojiMenu); return cb(window.emojiMenu);
}); });
spyOn(Cookies, 'set');
}); });
afterEach(function() { afterEach(function() {
// restore original url root value // restore original url root value
...@@ -190,28 +189,6 @@ ...@@ -190,28 +189,6 @@
return expect($thumbsUpEmoji.data("original-title")).toBe('sam'); return expect($thumbsUpEmoji.data("original-title")).toBe('sam');
}); });
}); });
describe('::addEmojiToFrequentlyUsedList', function() {
it('should set a cookie with the correct default path', function() {
gon.relative_url_root = '';
awardsHandler.addEmojiToFrequentlyUsedList('sunglasses');
expect(Cookies.set)
.toHaveBeenCalledWith('frequently_used_emojis', 'sunglasses', {
path: '/',
expires: 365
})
;
});
it('should set a cookie with the correct custom root path', function() {
gon.relative_url_root = '/gitlab/subdir';
awardsHandler.addEmojiToFrequentlyUsedList('alien');
expect(Cookies.set)
.toHaveBeenCalledWith('frequently_used_emojis', 'alien', {
path: '/gitlab/subdir',
expires: 365
})
;
});
});
describe('search', function() { describe('search', function() {
return it('should filter the emoji', function() { return it('should filter the emoji', function() {
$('.js-add-award').eq(0).click(); $('.js-add-award').eq(0).click();
......
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